SELECT Place.id, Place.name FROM Place LEFT JOIN Place_link ON Place.id=Place_link.Place WHERE Place.id!=1 AND Place_link.LinkTo!=1;
This section of the manual will probably help you further. http://www.mysql.com/doc/en/ANSI_diff_Sub-selects.html Edward Dudlik Becoming Digital www.becomingdigital.com Did I help you? Want to show your thanks? www.amazon.com/o/registry/EGDXEBBWTYUU ----- Original Message ----- From: "Grégory Verret" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, 25 June, 2003 00:31 Subject: SQL Query Hi all, I just looked at the mysql doc and I didnt find an answer to my question. does mysql has the minus statement ? or is there something similar ? SELECT something FROM somewhere MINUS SELECT something_else FROM somewhere; Or this one could do the job but mysql doesnt seems to accept it either.. SELECT id FROM there WHERE id != ( SELECT id FROM this_one ); so Here's what I want to do... my Tables are : CREATE TABLE Place ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, Name VARCHAR(60) NOT NULL, Desc TEXT, PRIMARY KEY (id) ); CREATE TABLE Place_link ( Place INT UNSIGNED NOT NULL REFERENCES Place(id), LinkTo INT UNSIGNED NOT NULL REFERENCES Place(id), PRIMARY KEY (Place, LinkTo) ); I got a table with different places (Amusement park, Store, etc... ) and the Place_linf table contains the id of a place (Place) and if from that place, you can go to another place, its in the LinkTo. example : You got the 1:Market, 2:Zoo, 3:Pool, 4:Arena, 5:Stadium From the market you can go to the zoo and the Arena, and from the pool, you can go to the zoo, and the market... so we have : Place - LinkTo 1 2 3 1 3 2 1 4 so my query is: I want Place(id,Name) from Place but not the market (id != '1') and not the place where the market has a link to (not 2, 4). And I dont know how to do this query... Anyone knows ? (if someone understand what im trying to do hehe) Thx Gregory -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]