I have 2 tables. Both tables contain information about a customer order. Table 1 is called: orders Table 2 is called: order_details Both tables have a common field called 'orders_id'. By using a keyword (variable) I can query the field 'description' in Table 2 and output certain information from that table. No problem. However, one piece of information 'order_status' is missing in Table 2 and is only contained in Table 1. How do I write a query that will output records from Table 2, but for each outputted record (or customer order) I am also able to output the 'order_status' of that order which is contained in Table 1. I must mention again, that field 'orders_id' is common in both tables. I will appreciate help from the pros in here. Thanks
Try something like this: SELECT d.*, o.order_status FROM order_details d, orders o WHERE d.description LIKE '%<your variable>%' AND d.order_id = 0.order_id; You might not want to use LIKE but replace this with whatever you are using to search the description now. Hope this helps