Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can this be done in one SQL Select?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00984864
Message ID:
00984899
Views:
24
>>I need help in selecting records from the following table (simplified):
>>
>>CUST_ID
>>ORD_DATE
>>ORD_TIME
>>
>>For a given date (ORD_DATE), I need to select one order record per customer (CUST_ID) based on the time of order (ORD_TIME). For example, the Order Time should be the latest of the day.
>>
>>I would appreciate any suggestions.
>>
>>Thank you.
>
>
>I suppouse CUST_ID, ORD_Date and ORD_Time are Field names. So try this:
>
>SELECT CUST_ID, ORD_Date, MAX(Ord_Time) AS Ord_Time FROM YourTable GROUP BY Cuts_Id INTO ...
>
Borislav and Jim,

You approach does not allow me to select other fields from the table because of Group By.

Thank you for your help.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform