Question: 1. query below, we are pulling capacity for the last 7 days. Please identifiy what is incorrect? a. missing select distinct clause b. case statement
| 1. query below, we are pulling capacity for the last 7 days. Please identifiy what is incorrect? | ||
| a. | missing select distinct clause | |
| b. | case statement is needed before the days of the week | |
| c. | last 7 day statement is wrong | |
| d. | Nothing is wrong | |
| e. | A & C | |
| case when a.stor_id = 'ABC' then 'FOOD LION' | ||
| when a.stor_id in ('ABG','ABJ') then 'The FOOD LION' | ||
| when a.stor_id = 'ABM' then 'Stop AND Shop' else null end as brand, | ||
| a.stor_id,ahdz_week, dlv_Dt, | ||
| case | ||
| when weekday(a.dlv_dt)='0' then 'Sunday' | ||
| when weekday(a.dlv_dt)='1' then 'Monday' | ||
| when weekday(a.dlv_dt)='2' then 'Tuesday' | ||
| when weekday(a.dlv_dt)='3' then 'Wednesday' | ||
| when weekday(a.dlv_dt)='4' then 'Thursday' | ||
| when weekday(a.dlv_dt)='5' then 'Friday' | ||
| when weekday(a.dlv_dt)='6' then 'Saturday' | ||
| else 'NODAY' end DOW, dlv_tm,d.city_tx ||' (' ||ahld_stor_nbr_cd ||')' CNC, d.ahld_stor_nbr_cd,district,region,open_dt, | ||
| sum(b.slot_avl_qy) slots,sum(c.slot_used_qy) ords | ||
| from art_dlv_slot_hdr a | ||
| join art_dlv_slot_dtl b on a.slot_hdr_id = b.slot_hdr_id | ||
| left join art_slot_dtl_use c on b.slot_id = c.slot_id | ||
| join daily_curr:cdt_pup_ctl d on a.stor_id = d.stor_id and b.dlv_area_id = d.dlv_area_id | ||
| join datamart:rdt_tm_look e on a.dlv_Dt = e.the_date | ||
| join analytic.rdt_ahld_brnd_hrc f on d.pup_id = f.pup_id | ||
| where a.stor_id like 'AB%' and d.pup_type_cd = 'CLICK' and d.open_dt | ||
| and b.ship_type_cd = 'PICKUP' | ||
| and ahdz_week = (select distinct ahdz_week from rdt_tm_look where the_Date = today-1) | ||
| =--and slot_avl_qy>0 | ||
| group by 1,2,3,4,5,6,7,8,9,10,11; | ||
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
