Re: Help - SQL question

From: Jan Vanparys <Vanparys.Jan_at_village.uunet.be>
Date: Tue, 15 Sep 1998 19:49:16 +0200
Message-ID: <6tm9cm$p25$1_at_xenon.inbe.net>


Hello,

Try this :

SELECT customer, MAX(period)
FROM yourtable
WHERE status_code = 'COM'
GROUP BY customer

Greetings,

Jan Vanparys
Belgium

NeedaHoliday heeft geschreven in bericht <35fe9cad.4809164_at_news.pwgsc.gc.ca>...
>I want to extract the last record from a table based on the following
>criteria:
>
>Table structure is INV_PER, CUSTOMER, STATUS CODE
>
>There are many periods and customers and i want to extract the last
>records for each customer that has a status code = 'COM'.
>
>i.e. CUSTOMER PERIOD STATUS
>
> 8001 199808 COM
> 8002 199807 COM
> 8003 199808 COM
>
> etc..
>
>Could someone point me in the right direction. Will I need a inner
>join or can I use something else
>
>Thanks in advance
Received on Tue Sep 15 1998 - 19:49:16 CEST

Original text of this message