none
using a case statement on two created fields

    Question

  • I created separate fields from fields in a table. I tried using a case when/then statement to create a third field but it did nothing. My question is can I use my own created fields within a query. They were created from fields within a table?

    example:  cast(datepart(month,hv.date)as varchar(2))+
                    cast(datepart(day,hv.date)as varchar(2))+
                    cast(datepart(year,hv.date)as varchar(4)) as 'DOV',
                    
                    cast(datepart(month,med.submittedDate)as varchar(2))+
                    cast(datepart(day,med.submittedDate)as varchar(2))+
                    cast(datepart(year,med.submittedDate)as varchar(4)) as 'DOD',

                    CASE WHEN 'DOV' = 'DOD' THEN 'DOD' ELSE '  ' end as 'Dose'

    Thursday, March 29, 2012 12:21 PM

Answers