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 query wanted

Re: sql query wanted

From: Stewart hector <stewart.hector_at_excite.co.uk>
Date: Thu, 21 Feb 2002 21:18:48 +0000
Message-ID: <nvdd8.6563$hM6.773062@news6-win.server.ntlworld.com>


I don't think your Your qeries can't be done as your data stands at the moment. For it to work, the values in sku have to be unique values, in your case, you have multiple rows that contain a, b, and c. For example, any selects you do that contain
"where sku ='a' "will return 1 and 7.

Rework your data or your application.

And it became to pass that on the Thursday 21 Feb 2002 5:15 pm, Christian Mallwitz did write as thus:

> Hi,
> This seems to much for me ...
> I have
>
> create table foobar (id varchar(10), sku varchar(10));
>
> insert into foobar values ('1', 'a');
> insert into foobar values ('2', 'b');
> insert into foobar values ('3', 'a');
> insert into foobar values ('3', 'b');
> insert into foobar values ('4', 'c');
> insert into foobar values ('5', 'a');
> insert into foobar values ('5', 'c');
> insert into foobar values ('6', 'a');
> insert into foobar values ('6', 'b');
> insert into foobar values ('7', 'a');
> insert into foobar values ('7', 'b');
> insert into foobar values ('7', 'c');
>
> Now I have to query based on sku: I need all id's where there are row's
> for that id with exactly the sku's provided.
>
> Example:
> if I have a it should return 1
> if I have b it should return 2
> if I have c it should return 4
> if I have a and b it should return 3 and 6
> if I have a and c it should return 5
> if I have a, b and c it should return 7
>
> Any advice?
> Thanks
> Christian
Received on Thu Feb 21 2002 - 15:18:48 CST

Original text of this message

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