General information
Category:
Coding, syntax & commands
>>>Can anyone tell me if the following can be done in a one line select statement. I cannot seem to get the results I require.
>>>
>>>I have one table with the following fields: Customer, Date, Price. I am simply trying to get the last price quoted to the customer.
>>>
>>>CustA, 01/01/01, 100
>>>CustA, 01/01/97, 111
>>>CustB, 02/02/96, 200
>>>CustB, 02/02/02., 222
>>>
>>>I want my result to be:
>>I have one table with the following fields: Customer, Date, Price. I am simply trying to get the last price quoted to the customer.
>>
>>CustA, 01/01/01, 100
>>CustA, 01/01/97, 111
>>CustB, 02/02/96, 200
>>CustB, 02/02/02., 222
>>
>>I want my result to be:
>>
>>CustA, 01/01/97, 111
>>CustB, 02/02/96, 200
*******************************
Here is the correct way to do this.
SELECT * FROM Quotes ;
WHERE DTOC(Date)+Customer IN ;
(SELECT MAX(DTOC(Date)+Cutomer FROM Quotes GROUP BY Customer)
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only