JElster
asked on
Get min date from column values
I have a table with 10 datetime columns/fields.
How do I get the min date of all the fields.
DATE1, DATE2, DATE3, DATE4, DATE5....
What is the SQL to get the MIN date from columns in the same record?
Need the earliest date of any of the 10 datetime columns.
thx
How do I get the min date of all the fields.
DATE1, DATE2, DATE3, DATE4, DATE5....
What is the SQL to get the MIN date from columns in the same record?
Need the earliest date of any of the 10 datetime columns.
thx
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is sql server 2005
Incorrect syntax near the keyword 'WITH'.
Incorrect syntax near the keyword 'WITH'.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
IMHO, depending on how many date Columbus you have, unpivot is better than trying to union all for the columns.
ASKER
just needed a fast simple solution.. don't have time now to research pivot
thx
thx
Open in new window