Skip to content
Advertisement

SQL select specific column which are present for all date range

How should I write a SQL queries to find all unique value of a column that are present in all date range.

In the above example if query date range is 2020-03-01 to 2020-03-04 output should be

since only a and b are present for that range similarly if query date range is 2020-03-01 to 2020-03-03 output should be

I could do this in an python script by fetching all rows and using a set. Is is possible to write a SQL query yo achieve same result?

Advertisement

Answer

You may aggregate by column value and then assert the distinct date count:

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