Home Forums SQL Server 2008 T-SQL (SS2K8) How to get Distinct values across the table? RE: How to get Distinct values across the table?
robert.gerald.taylor
SSChampion
Points: 13133
More actions
September 19, 2012 at 6:20 am
#1539506
Couldn't you just unpivot your data? Something like:
SELECT DISTINCT SpecificCols
FROM
(SELECT col1, col2, col3, col4
FROM @t) t
UNPIVOT
(SpecificCols FOR AllCols IN (col1, col2, col3, col4)) AS unpvt;
HTH,
Rob