Read all records except specified ...

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
fatman
Forum Commoner
Posts: 47
Joined: Fri Jul 21, 2006 11:18 am
Location: Portugal

Read all records except specified ...

Post by fatman »

I want to read all records in the DB excluding a specified value contained in a field called 'host' in the following query, with a supplied value e.g.: '$ip_adress':

Code: Select all

$query_myStats = "SELECT * FROM myStats WHERE `no` > 1 ORDER BY `no` DESC";
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Code: Select all

SELECT * FROM myStats WHERE `no` > 1 AND `hosts` <> 'exludeMe' ORDER BY `no` DESC;
User avatar
fatman
Forum Commoner
Posts: 47
Joined: Fri Jul 21, 2006 11:18 am
Location: Portugal

Thanks, perfect

Post by fatman »

It makes perfect sense, but I would never have thought ...
Post Reply