mercredi 10 janvier 2018

Issue with my case statement and two dates

In my case statement i have a date for the previous day with a very specific time. that specific time i need for the last 6 weeks in the case statement however due to my 2nd date statement it does not return the correct values.

select storeid, orderId, createdDate, case when generatedBy = 0 and (createdDate between '2018-01-09 23:45:00' and '2018-01-09 23:45:59')
then 'Auto' when generatedBy = 0 then 'PDA Trigger' when generatedBy > 0 then 'User Trigger' end as 'Triggered By' from mb_delinotestaging where createdDate between '2018-01-09' and '2018-01-10' ;

Aucun commentaire:

Enregistrer un commentaire