Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Problem: invite SQL...
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