I have a query that selects a bunch of fields related to the names and addresses of clients, but it comes down to:
SELECT DISTINCT a, b, c, ... FROM big_dumb_flat_table
it returns a bunch of records (10986590). When I replace the commas in the selection list, format it as a concatenated string divided into pipes:
SELECT DISTINCT a + '|' + b + '|' + c + '|' + ... FROM big_dumb_flat_table
it returns another 248 records. I reassured myself that in any of the fields there are no pipes that could tighten the fidelity of the returned set. What's going on here?
sql sql-server sql-server-2005 concatenation
clweeks
source share