Query where id is not equal to (WHERE id <> 6)

Post Reply
User avatar
sonik
Site Admin
Posts: 37
Joined: 12 Nov 2018, 22:12

Query where id is not equal to (WHERE id <> 6)

Post by sonik » 27 May 2019, 14:16

Have you ever needed a query where you search for all except one thing?
Here is an example of a query where you search for all except the number 6:

SELECT user_id, username FROM users WHERE user_id <> 6

If you have ten users with id from one to ten , number six won't be in the executed query.

Post Reply