Click to See Complete Forum and Search --> : MYSQL select, exclude certain results


jayke00
11-25-2003, 05:19 PM
Hey,

I was wondering if its possible to query the database but exclude certain information. I'm wanting to search a table for all the users I have, but exclude a single user from that search. What im wanting is an 'exclude' option:

select * from table where user_info='user_info' exclude user_id='user_id'

Does anyone know how I could do this, or if it's even possible.

Thanks :)

pyro
11-25-2003, 05:27 PM
Yeah, you use something like this:

$sql = "SELECT * FROM `tablename` WHERE `fieldname` != 'something'";

jayke00
11-25-2003, 05:37 PM
Perfect!

Thanks :)

pyro
11-25-2003, 05:48 PM
You bet... :)