SELECT MAX(CASE code WHEN 'sdt' THEN convert(datetime,Cval) ELSE NULL END) as MinDate,
MAX(CASE code WHEN 'Edt' THEN convert(datetime,Cval) ELSE NULL END) as MaxDate
from table
Cval in table is varchar(20). value holds in this column is '2015034' Now I have to compare this coulm value to datetime valve for that in the query how Cval column will be converted to datetime?
If I had to convert 2015034 to a date, I wouldn't have a clue how to do it. Can you explain?
Wonder if its a year and some form of Julian date, possibly where 034 is representing the day of the year.