I have a two tables which essentially have a one to many relationship. Let's call the first one custmrs and the second one orders. I want to have a SELECT statement will return matching results that only shows the most recent order for each customer.
I thought I could do something like this, but it doesn't work. I get a Group By clause is missing or invalid error message. What am I doing wrong?
SELECT * FROM custmrs JOIN orders ON custmrs.clientid = orders.clientid INTO CURSOR csrTemp ORDER BY custmrs.clientid, orders.orddate DESC GROUP BY custmrs.clientid
Thanks,
Don