Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SELECT - SQL avoiding duplicates?
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
SELECT - SQL avoiding duplicates?
Miscellaneous
Thread ID:
00856923
Message ID:
00856923
Views:
44
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
Don Knoup
don.knoup@ticomix.com
Ticomix, Inc.
Next
Reply
Map
View

Click here to load this message in the networking platform