The query selects the following columns:

  1. '2019-02-20' as dt: This column represents the date '2019-02-20'.
  2. concat(date_add(next_day('2019-02-20','MO'),-7),'_',date_add(next_day('2019-02-20','MO'),-1)) as wk_dt: This column represents the week range for the given date. It concatenates the start and end dates of the week, which is determined by subtracting 7 days from the next Monday.
  3. count(*): This column represents the count of records.

The query retrieves data from three different tables: dws_uv_detail_wk, dws_new_mid_day, and dws_uv_detail_wk. It performs several subqueries to filter the data based on specific conditions and join the results together. The final result is the count of records where the mid_id is not present in the dws_new_mid_day table for the given week range.

SQL Query to Count Records with Missing Data for a Specific Week

原文地址: https://www.cveoy.top/t/topic/qkIM 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录