How do I remove NULL values from a query result in SQL

Viewed 244

I am joining two tables Wands and Wands_Property to get specific information. In my SELECT statement, I have this statement

SELECT 
    Wands.id, Wands_Property.age, Wands.coins_needed,
    CASE
        WHEN Wands_Property.is_evil = 0 
           THEN Wands.power
    END
FROM Wands

Right so, if the is_evil column in the Wands_Property table is 0, then I want to display the power column from the Wands table.

However the result displays the rows that meet the condition, and ones that don't meet the condition display NULL. I do not want the rows that display Null to appear in my result at all. What can I do? Thanks

1 Answers

Use a where clause to filter rows:

SELECT Wands.id, Wands_Property.age, Wands.coins_needed,
       Wands.power
FROM Wands
WHERE Wands_Property.is_evil = 0
Related