Skip to content
Advertisement

SQL query help using two WHERE clauses

I have a table with data spanning about two weeks. I want to see the average for the first 7 days and then the next 8.

I have tried various JOINS with no luck. I am new to SQL so I am probably missing something simple.

Basically these queries work. How do I combine them?

Advertisement

Answer

If you really need to combine them, then you can do sub-queries:


Please note that you wish to use SUM instead of COUNT, because COUNT just get rows count, not it’s values summed up.

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