Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: help queries
There might be more sophisticated solutions but I think this one might work
hth, marc
Select alias1.car,alias1.optional, alias2.optional
from table alias1, table alias2
where alias1.car = alias2.car
and alias1.optional = 1
and alias2.optional = 5
Select alias1.car,alias1.optional, alias2.optional
from table alias1, table alias2
where alias1.car = alias2.car
and alias1.optional = 1
and alias2.optional = 5
and not exists (select 1 from table alias3
where alias1.car = alias3.car and alias3.optional = 3)
"Virgilio Gambarotto" <gambarotto_at_greensoft.it> wrote in message
news:2Qip7.47952$F45.492136_at_news1.tin.it...
> Hi
> I have a table like this:
> car optional
> ford 1
> ford 2
> ford 5
> gm 3
> gm 1
> gm 5
> ferrari 1
> ferrari 7
> Q1
> I need to retrieve only cars having optioinals 1 and 5
> result must be
> ford 1 5
> gm 1 5
>
> Q2
> I need to retrieve only cars having optioinals 1 and 5 and not 3
> result must be
> ford 1 5
>
> Tia
> i_mac
>
>
Received on Tue Sep 18 2001 - 04:35:26 CDT
![]() |
![]() |