The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.
IF :end_day > 17
SELECT dbo.ord_hdr.jul_rlse_dy + dbo.ord_hdr.rlse_cycle + dbo.ord_hdr.trlr_seg as 'wave',
'New' as 'status',
sum(dbo.ord_hdr.crd_tot_nbr) as 'tot_os',
sum(dbo.ord_hdr.aces_tot_nbr) as 'tot_acc',
sum(dbo.ord_hdr.prpk_tot_nbr) as 'tot_pp',
sum(dbo.ord_hdr.addon_tot_nbr) as 'tot_sao',
' ' as 'ws_os',
' ' as 'ws_acc',
' ' as 'ws_pp',
' ' as 'ws_sao',
' ' as 'wc_os',
' ' as 'wc_acc',
' ' as 'wc_pp',
' ' as 'wc_sao'
FROM dbo.ord_hdr
WHERE ( convert(integer,dbo.ord_hdr.jul_rlse_dy) >= :start_day) AND
( convert(integer,dbo.ord_hdr.jul_rlse_dy) <= :end_day)
group by dbo.ord_hdr.jul_rlse_dy + dbo.ord_hdr.rlse_cycle + dbo.ord_hdr.trlr_seg
ELSE
SELECT dbo.ord_hdr.jul_rlse_dy + dbo.ord_hdr.rlse_cycle + dbo.ord_hdr.trlr_seg as 'wave',
'New' as 'status',
sum(dbo.ord_hdr.crd_tot_nbr) as 'tot_os',
sum(dbo.ord_hdr.aces_tot_nbr) as 'tot_acc',
sum(dbo.ord_hdr.prpk_tot_nbr) as 'tot_pp',
sum(dbo.ord_hdr.addon_tot_nbr) as 'tot_sao',
' ' as 'ws_os',
' ' as 'ws_acc',
' ' as 'ws_pp',
' ' as 'ws_sao',
' ' as 'wc_os',
' ' as 'wc_acc',
' ' as 'wc_pp',
' ' as 'wc_sao'
FROM dbo.ord_hdr
WHERE ( convert(integer,dbo.ord_hdr.jul_rlse_dy) >= :start_day) OR
( convert(integer,dbo.ord_hdr.jul_rlse_dy) <= :end_day)
group by dbo.ord_hdr.jul_rlse_dy + dbo.ord_hdr.rlse_cycle + dbo.ord_hdr.trlr_seg
SELECT dbo.ord_hdr.jul_rlse_dy + dbo.ord_hdr.rlse_cycle + dbo.ord_hdr.trlr_seg as 'wave'
, 'New' as 'status'
, sum(dbo.ord_hdr.crd_tot_nbr) as 'tot_os'
, sum(dbo.ord_hdr.aces_tot_nbr) as 'tot_acc'
, sum(dbo.ord_hdr.prpk_tot_nbr) as 'tot_pp'
, sum(dbo.ord_hdr.addon_tot_nbr) as 'tot_sao'
, ' ' as 'ws_os'
, ' ' as 'ws_acc'
, ' ' as 'ws_pp'
, ' ' as 'ws_sao'
, ' ' as 'wc_os'
, ' ' as 'wc_acc'
, ' ' as 'wc_pp'
, ' ' as 'wc_sao'
FROM dbo.ord_hdr
WHERE dbo.ord_hdr.jul_rlse_dy >= :start_day
AND dbo.ord_hdr.jul_rlse_dy < :end_day
GROUP
BY dbo.ord_hdr.jul_rlse_dy + dbo.ord_hdr.rlse_cycle + dbo.ord_hdr.trlr_seg
WHERE (( convert(integer,dbo.ord_hdr.jul_rlse_dy)) BETWEEN :start_day AND :end_day OR
( convert(integer,dbo.ord_hdr.jul_rlse_dy)) BETWEEN :start_day2 AND :end_day2)
SELECT dbo.ord_hdr.jul_rlse_dy + dbo.ord_hdr.rlse_cycle + dbo.ord_hdr.trlr_seg as 'wave',
'New' as 'status',
sum(dbo.ord_hdr.crd_tot_nbr) as 'tot_os',
sum(dbo.ord_hdr.aces_tot_nbr) as 'tot_acc',
sum(dbo.ord_hdr.prpk_tot_nbr) as 'tot_pp',
sum(dbo.ord_hdr.addon_tot_nbr) as 'tot_sao',
' ' as 'ws_os',
' ' as 'ws_acc',
' ' as 'ws_pp',
' ' as 'ws_sao',
' ' as 'wc_os',
' ' as 'wc_acc',
' ' as 'wc_pp',
' ' as 'wc_sao'
FROM dbo.ord_hdr
WHERE :start_day < :end_day AND
( ( convert(integer,dbo.ord_hdr.jul_rlse_dy) >= :start_day) AND
( convert(integer,dbo.ord_hdr.jul_rlse_dy) <= :end_day) )
group by dbo.ord_hdr.jul_rlse_dy + dbo.ord_hdr.rlse_cycle + dbo.ord_hdr.trlr_seg
UNION ALL
SELECT dbo.ord_hdr.jul_rlse_dy + dbo.ord_hdr.rlse_cycle + dbo.ord_hdr.trlr_seg as 'wave',
'New' as 'status',
sum(dbo.ord_hdr.crd_tot_nbr) as 'tot_os',
sum(dbo.ord_hdr.aces_tot_nbr) as 'tot_acc',
sum(dbo.ord_hdr.prpk_tot_nbr) as 'tot_pp',
sum(dbo.ord_hdr.addon_tot_nbr) as 'tot_sao',
' ' as 'ws_os',
' ' as 'ws_acc',
' ' as 'ws_pp',
' ' as 'ws_sao',
' ' as 'wc_os',
' ' as 'wc_acc',
' ' as 'wc_pp',
' ' as 'wc_sao'
FROM dbo.ord_hdr
WHERE :start_day > :end_day AND
( ( convert(integer,dbo.ord_hdr.jul_rlse_dy) >= :start_day) OR
( convert(integer,dbo.ord_hdr.jul_rlse_dy) <= :end_day))
group by dbo.ord_hdr.jul_rlse_dy + dbo.ord_hdr.rlse_cycle + dbo.ord_hdr.trlr_seg
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.