find missing dates from date range

后端 未结 6 2050
小蘑菇
小蘑菇 2020-12-16 05:49

I have query regarding get the dates which are not exists in database table.

I have below dates in database.

2013-08-02
2013-08-02
2013-08-02
2013-08         


        
6条回答
  •  悲&欢浪女
    2020-12-16 06:28

    The way I would solve in this in a datawarehouse-type situation is to populate a "static" table with dates over an appropriate period (there are example scripts for this type of thing which are easy to google) and then left outer join or right outer join your table to it: rows where there are no matches are the missing dates.

提交回复
热议问题