Web Programming: MYSQL ‘not equal to’ statement

There are a number of ways to do this.

Use:

WHERE ‘something’ <> ‘something_else’

or:

WHERE ‘something’ != ‘something_else’

As they are identical.

or you can specify a number of values you don’t want to be return from your column/field (my_tablein this example) – a more efficient way of doing things if you have a lot of values:

WHERE my_table NOT IN (‘something’, ‘something_else’);

source: Emperor @ ozoneasylum.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s