I have two queries:
'SELECT * FROM `table `WHERE weight = 0 OR weight IS NULL'
and
'SELECT * FROM `table `
The first query returns around 4000 values, the second query returns around 4100.
I’m attempting to create a query that will return the rows which are distinct between the two values, I’m attempting this by using a nested or sub query but I’m struggling with syntax here. Having only worked with very simple queries before. Could anyone suggest how I might do this.
Advertisement
Answer
I think this does what you want:
SELECT * FROM `table` WHERE NOT (weight = 0 OR weight IS NULL);
That is more simply written as:
SELECT * FROM `table` WHERE weight <> 0;