Link to home
Start Free TrialLog in
Avatar of Philippe Renaud
Philippe RenaudFlag for Canada

asked on

SQL select query problem

Hello EE,

Let'say i have 2 tables.

First table has:   ID, Description
Second has ID, (same id that table1)

in first table i have values:    1,2,3,4,5

how can I do a SELECT that if there is nothing in table 2  it returns  1,2,3,4,5  if lets say there is 1 and 3 it will return 1,2,4,5

lets say in table 2 there is 4,5  it would return 1,2,3

can y u help ?
ASKER CERTIFIED SOLUTION
Avatar of knightEknight
knightEknight
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

select ID, Description
from table1
left join table2 on table2.id = table1.id
where table2.id is null
Avatar of Philippe Renaud

ASKER

ahh...thanks.