Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Statement

Re: SQL Statement

From: Rajesh M <raju_m_at_hotmail.com>
Date: 1998/10/20
Message-ID: <362cc949.0@news.euroconnect.dk>#1/1

Hi Gaironi,
Thanks a lot, BUT I did try it out with the UNION and subquery and I got the expected result. My idea of posting the original message was to know if there are any other ways of doing the same query. The actual query that I need is more complex and has a lot of SQL Functions. I am worried about performance when the number of rows in the table is too much.

Thanks a lot,
Rajesh

gaironi wrote in message <70igoa$rmk$1_at_news.flashnet.it>...
>Dear Rajesh M,
>you can try in this way
>select a.orderno,a.orderdate,a.customer
> from tablex a
>where a.orderdate = '20-10-98'
>union
>select b.orderno,b.orderdate,b.customer
>from tablex b
>where b.orderdate <> '20-10-98'
>and exists (select 1 from tablex c
>where c.customer = b.customer
> and c.orderdate = '20-10-98').
>Write me back with the result.
>bye Giovanni.
>Rajesh M ha scritto nel messaggio <362cb89c.0_at_news.euroconnect.dk>...
>>Hi,
>> I have problem with SQL. Could somebody please help !!!
>>
>>Table X
>>OrderNo OrderDate Customer
>>-----------------------------------------------
>>1 20-10-98 1000
>>2 19-10-98 1000
>>3 20-10-98 2000
>>4 17-10-98 3000
>>
>>I would like to have a single query which returns
>>all the OrderNo dated '20-10-98' (i.e., Customer 1000,2000) and OrderNo
>>dated before '20-10-98' for customer with OrderDate='20-10-98'.
>>
>>The expected result for the query is as follows :
>>OrderNo OrderDate Customer
>>-----------------------------------------------
>>1 20-10-98 1000
>>2 19-10-98 1000
>>3 20-10-98 2000
>>
>>Please help and thanks in advance,
>>
>>Rajesh
>>
>>
>
>
Received on Tue Oct 20 1998 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US