Dates used in SQL query - Microsoft Community


hello,

i have query selects date field. want replace date returned text when meets criteria.

for instance, if date returned between 10/01/2016 , 9/30/2017 want value returned "fy2017"

i have tried using "decode", cannot work. here code have:

select distinct f.facid, c.cmptype, decode(c.recvddate between to_date('10/01/2016, 'mm/dd/yyyy') , to_date('09/30/2017','mm/dd/yyyy'), 'fy2017', 'other')

from cintake c 

join facility f on f.facid = c.facid

where

c.recvdate between to_date('10/01/2016','mm/dd/yyyy') and  to_date('09/30/2017','mm/dd/yyyy')

lf remove decode part works fine , can change in excel, want automatically.

thanks!

i don't have instance of oracle handy test on, think want computed column:

case when c.recvddate >= date '2016-10-01' , c.recvddate < date '2017-10-01' 'fy2017' else 'other' end fy

let me know if works.



Office / Access / Windows 8 / Office 2016



Comments

Popular posts from this blog

Getting ErrorCode: 120018 when trying to access Microsoft account - Microsoft Community

The message was sent to a distribution list ‎(DL)‎ - Microsoft Community

Activation Error 0x8004FE93 - Microsoft Community