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 -> Problem: invite SQL...

Problem: invite SQL...

From: Dmitry M.Ivlev <Dimon_at_Diogen.nstu.nsk.su>
Date: Thu, 9 Jul 1998 15:09:06 +0600
Message-ID: <6o215o$8up$1@nic.nstu.nsk.su>


Hi!

I have not much experience to use SQL. I want invite SQL described below under Oracle and can't imagine how. I have two tables (foods and what person ate):
CREATE Food(FoodID INTEGER, FoodName CHAR(20))

INSERT INTO T1 VALUES (1, 'Fish')
INSERT INTO T1 VALUES (2, 'Milk')
INSERT INTO T1 VALUES (3, 'Pie')
INSERT INTO T1 VALUES (4, 'Meat')

CREATE Ate(FoodID INTEGER, PersonName CHAR(20))

INSERT INTO T2 VALUES (1, 'Mishel')
INSERT INTO T2 VALUES (2, 'Mishel')
INSERT INTO T2 VALUES (3, 'Mishel')
INSERT INTO T2 VALUES (1, 'Dmitry')
INSERT INTO T2 VALUES (4, 'Dmitry')

Now how can I select (for given person) all foods plus one boolean field which has true if persone ate this kind of food: RESULT for Dmitry must be:
1 Fish TRUE
2 Milk FALSE
3 Pie FALSE
3 Meat TRUE

for Mishel it gives:
1 Fish TRUE
2 Milk TRUE
3 Pie TRUE
3 Meat FALSE

How can I do it making ONW QUERY?

Dmitry.
email: Dimon_at_Diogen.nstu.nsk.su Received on Thu Jul 09 1998 - 04:09:06 CDT

Original text of this message

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