I am using the code below because it does what I need, but I need the result to be formatted as yyyy-mm-dd
. It is formatted as a string of course as: Feb 19 2016 12:00AM
, but in that case I need: 2016-02-19
instead. I am using SQL Server and can only extract from the db, can't write :(
coalesce(cast(
case
when lsf2.STARTDATE > lsf.STARTDATE then nph2.STARTDATE
else NULL
end as varchar(20)
),'') as 'StartDate'