RE: SQL help
- From: "Lex de Haan" <lex.de.haan@xxxxxxxxxxxxxx>
- To: <dubey.sandeep@xxxxxxxxx>, <oracle-l@xxxxxxxxxxxxx>
- Date: Mon, 10 Oct 2005 18:07:47 +0200
what about:
select * from t
where exists(select 1 from t where id=1)
and exists(select 1 from t where id=2)
and exists(select 1 from t where id=3);
kind regards,
Lex.
------------------------------------------------------------------
Steve Adams Seminar http://www.naturaljoin.nl/events/seminars.html
------------------------------------------------------------------
-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On
Behalf Of Sandeep Dubey
Sent: Monday, October 10, 2005 17:54
To: oracle-l@xxxxxxxxxxxxx
Subject: SQL help
Hi,
I am having weekend hangover with seemingly simple sql requirement.
create table t(id number);
insert into t values(1);
insert into t values(2);
commit;
I want to query this with an Id set. All values in the set should be there to
return me any row.
e.g.
select * from t where id in (1,2); return 1 and 2
If am serching for 1,2,3 if any one value is missing I should not get any data.
e.g.
select * from t where id in (1,2,3) should not return any row.
How to rewrite the above query with (1,2,3) that should not return me any row.
Thanks
Sandeep
--
http://www.freelists.org/webpage/oracle-l
BEGIN:VCARD
VERSION:2.1
N:de Haan;Lex
FN:Lex de Haan
ORG:Natural Join B.V.
TEL;WORK;VOICE:+31.30.2515022
TEL;HOME;VOICE:+31.30.2518795
TEL;CELL;VOICE:+31.62.2955714
TEL;WORK;FAX:+31.30.2523366
ADR;WORK:;;Pieter Breughelstraat 10;Utrecht;;3583 SK;Netherlands
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:Pieter Breughelstraat 10=0D=0AUtrecht 3583
SK=0D=0ANetherlands
URL;WORK:http://www.naturaljoin.nl
EMAIL;PREF;INTERNET:lex.de.haan@xxxxxxxxxxxxxx
REV:20040224T160439Z
END:VCARD
- References:
- SQL help
- From: Sandeep Dubey
Other related posts:
- » SQL help
- » Re: SQL help
- » Re: SQL help
- » SQL help
- » RE: SQL help
- » RE: SQL help
- » Re: SQL help
- » RE: SQL help
- » SQL help
- » RE: SQL help
- » Re: SQL help
- » Re: SQL help
- » Re: SQL help
- » SQL help
- » Re: SQL help
- » RE: SQL help
- » Re: SQL help
- SQL help
- From: Sandeep Dubey