Skip to content
Advertisement

Adding Where Clause To Query Skews Result Set

I am attempting to include all data from my calendar table and only the data from my sales table that meets the where criteria. My issue is that the query I am executing ONLY returns the months that the WHERE person has sales.

How should this MySQL query be altered so that everything from LEFT table is returned?

Advertisement

Answer

You should not use left joined table’s column in where condition because this way work as an inner join
instead add the condition to the ON clause

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