I have two tables - Customers, and Orders. Each Customer will have 1..n Orders. They have a relation on a Foreign Key to the Customers table in the Orders table. So far, so DB 101.
I need a query that will return a single row per Customer, together with the date and Order ID of that customer's latest order. ALL Customers have at least one order. I can easily do this with a function, but I'd prefer to do it in SQL.
JOINmanual - Tikkescustomer_orders. In this table you would link the customer_id with the different order_ids. Each record presents a link to an order in the orders table. This makes it much easier to do such things . A good explanation can be found here This technique is called normalization - Tikkes