PDA

View Full Version : SQL Query Help


MarkB
12-20-2001, 05:40 AM
Hiyis,

How do I state in an SQL query that I want to get all results EXCEPT those with a particular value?

EG:

SELECT * FROM forum,othertable WHERE displayorder<>0 AND active=1 AND forumid!=othertablefield

This isn't working, so I'm assuming that's incorrect useage... IS it possible?

(ie, I want all results except those where forumid matches the value in othertablefield)

Thanks:)
Mark

Freddie Bingham
12-20-2001, 11:07 PM
You use <> to signify NOT EQUAL, not !=.

MarkB
12-20-2001, 11:50 PM
Ah-ha! Thanks Freddie :D

Admin
12-21-2001, 12:04 PM
Although != also works (or at least on some versions of MySQL).

MarkB
12-21-2001, 12:08 PM
Neither is working for me, tho I'm guessing it's the way I'm wording the SQL call rather than using <> or !=

I shall struggle on :)