Efterfølgende mellemrum kan forårsage dette. For strengsammenligninger ignoreres disse.
CREATE TABLE #T
(
a varchar(10),
b varchar(10),
c varchar(10)
)
INSERT INTO #T
SELECT 'a ' as a, 'b' as b, 'c ' as c union all
SELECT 'a' as a, 'b' as b, 'c ' as c
SELECT DISTINCT a, b, c
FROM #T /*1 result*/
SELECT DISTINCT a + '|' + b + '|' + c + '|'
FROM #T /*2 results*/
SELECT DISTINCT LTRIM(RTRIM(a)) + '|' + LTRIM(RTRIM(b)) + '|' +
LTRIM(RTRIM(c)) + '|'
FROM #T /*1 result*/