>>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.
>
>
>dGivenDate=DATE()
>SELECT * INTO CURSOR Results;
> FROM theTable T ;
> WHERE ORD_DATE=m.dGivenDate;
> AND T.ORD_TIME =(SELECT MAX(ORD_TIME) FROM theTable WHERE ORD_DATE=T.ORD_DATE AND CUST_ID=T.CUST_ID)
>
Fabio,
Thank you very much for the suggestion. I will try it tomorrow. Right now I am working on the approach with a query with UDF.
"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