Re: SQL script question / group by ?

From: Stefan Rudolph-Klindtwort <StefanRudolph-Klindtwort_at_t-online.de>
Date: Fri, 26 Nov 1999 16:40:39 +0100
Message-ID: <81m9j4$4mu$1_at_news07.btx.dtag.de>


Stefan Rudolph-Klindtwort <StefanRudolph-Klindtwort_at_t-online.de> schrieb in im Newsbeitrag: 81m97v$4ju$1_at_news07.btx.dtag.de...
> Hello,
>
> if I understand your prob you can use a simple SQL-Statement :
>
> select store_num, next_date
> from states
> where trunc(trading_date) = to_date ( '19991108','YYYYMMDD' );
>
> If there are more than one row for each store you have to use
>
> select distinct store_num, next_date ...
>
> Hope to help you ...
>

Sorry it must be :

select s1.store_num, s1.trading_date, col1, col2 ... from states s1
where s1.trading_date = (select s2.next_date from states s2 where to_char(s2.trading_date, 'YYYYMMDD') = '19991108' and s2.store_num = s1.store_num ); Received on Fri Nov 26 1999 - 16:40:39 CET

Original text of this message