Michelle de Beer wrote:

I have two tables. One with names and one for
excluding certain names. Exclude-table contains the
uid for the name excluded.

If I want to see which names has been excluded, this
query does the job:
Select n.uid, n.name from names_tables n, exclude
WHERE n.uid = exclude.n_uid
But if I want to select all names, but leave out the
ones that are in the "exclude"-table, I thought this
would do it, but no.
Select n.uid, n.name from names_tables n, exclude
WHERE n.uid != exclude.n_uid
It has something to do with the != thingy...

Any thoughts?

You are trying to do a join in a way you should not :-) Generally it is a bad idea to do a join based on a non-equality. It does not do what you think it does. (Look into how relational databases and joins work.)

You should select your excluded values from the exclude table, the subtract irrelevant rows from table n. Are you using MySQL 3.xxx or 4.xxx?

- Cs.





---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to