streetwitch
streetwitch

Reputation: 1

Syntax error using IS NOT in where clause

Can anyone help my find this syntax error?

SELECT `song`, COUNT(*)
FROM `2015_awards`
WHERE `song` IS NOT `NoVote`
GROUP BY `song`;

I'm trying to exclude NoVote songs, and it won't work. Everything else is fine. When I Google problems like this, it looks as though it should work.

Upvotes: 0

Views: 71

Answers (3)

Phil Gabardo
Phil Gabardo

Reputation: 142

The IS Keyword is only for NULL comparisons. As Pigasus says, you probably should be using <>.

Hope this will solve your problem

Upvotes: 1

Pigasus
Pigasus

Reputation: 130

IS NOT is wrong. What you probably need to use is <>.

Upvotes: 3

deviloper
deviloper

Reputation: 7240

You cant not use pass NoVote as a value to IS or IS NOT Try this:

SELECT song, COUNT(*) FROM 2015_awards WHERE song != 'NoVote' GROUP BY song;

Upvotes: 2

Related Questions