PDA

View Full Version : problem with sql query


maxpouliot
05-04-2009, 05:51 PM
Hi, i want to make a query where i list entries from a table but i want to exclude certain entries.

table 1 fields : id, name
table 2 fields : id, question, employee

I want to show all the table 1 entries that have no entries in the table 2 question field (table1.id=table2.question) + table2.employee.

What i want to do is list questions that have not been answered by an employee. Am i clear enough?

Thanks

hthought
05-04-2009, 06:05 PM
You can do something like

SELECT * FROM table1 WHERE NOT IN (SELECT * FROM table2)

This would select things from table1 that are not on table2, i think that's what you want to do is that right?

maxpouliot
05-04-2009, 06:08 PM
Exactly! Thanks!