user11875019
user11875019

Reputation:

Don't display row the condition is accomplished SQL

I have :

select if(G.grade<5,G.grade,NULL)

what condition should I instead of NULL to not display the rows?

Upvotes: 0

Views: 36

Answers (1)

Hogan
Hogan

Reputation: 70523

In sql we have a a where statement

select -- *
from something
where g.grade<5

thisis how you filter rows in sql


You're tottaly different question (in the comment) is solved like this:

SELECT CASE WHEN g.grade < 5 THEN g.grade ELSE null END AS badgrade,
       CASE WHEN g.grade >=5 THEN g.grade ELSE null END AS goodgrade
FROM G

Upvotes: 3

Related Questions