Skip to content
Advertisement

sql query to display those with 0

I have to show drivers and nr of trips in January 2019. I also need to show those with 0 trips in January 2019. Below is the query, but it doesnt show me those with 0 trips in january 2019.

I think that there is a problem in the -where- but i cant find it. I am using oracle sql developer

Advertisement

Answer

Move the condition to an on clause and use date literals:

Note that I changed the upper limits for the date comparison — less than the first of January. This is particularly important in Oracle, because dates can contain a time component, even if you cannot see it when you query the table. This version is safe for data with or without a time component.

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