Forum Moderators: open

Message Too Old, No Replies

access query

how to join query from two table

         

stipica

7:13 pm on Apr 7, 2007 (gmt 0)

10+ Year Member



Hello,
I have two tables: TYPES and NAME_TYPE.
TYPES:
type
A
B
C
D
E

NAME_TYPE
name surname type
John Doe C
John Doe B
Jack Daniels D
Will Smith C
Brad Pitt A
George Dumb E

and I want to display all types that don't belong for some person.
For example if person is George Dumb, i want query to return result:
A
B
C
D
or if person is John Doe, query result need to be:
A
D
E

Anyone know how should I do that, please?

souFrag

8:58 pm on Apr 7, 2007 (gmt 0)

10+ Year Member



SELECT type FROM types, name_type WHERE name <> 'John Doe' GROUP BY type

stipica

7:21 pm on Apr 13, 2007 (gmt 0)

10+ Year Member



didn't work :(
But this worked :)

SELECT type from TYPES WHERE type not in
(SELECT type FROM name_type WHERE name="John")