sql server - SQL Select for create daily log data from more than one date column frrom a single table -
i have table more 1 date column,
each date column hold date or null value,
want write sql query display each column have date new row new additional column named logdate contain same date of column.
difficult explain, please referrer attached image.
just use union all
concatenate 3 result sets:
select [receiveddate] logdate, * mytable [receiveddate] not null union select [closing date] logdate, * mytable [closing date] not null union select [lpodate] logdate, * mytable [lpodate] not null
to sort logdate add following order clause end of query:
order logdate
Comments
Post a Comment