Skip to content
Advertisement

MySQL-Statement. How do i skip rows in query where all rows equal null

I have created a query to construct a table with the following code:

The above code returns the following table:

Image of table

I would like to write a piece of in which i can skip a row if all columns except the date column returns NULL. Is that possible?

Thanks in advance!

Advertisement

Answer

Assuming that column value is not nullable, you can add another condition to the WHERE clause that ensures that at least one of the conditions in the aggregate functions will be met:

If value may be null, you would just add another condition:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement