This should work: Select distinct code1 from datatable union Select distinct code2 from datatable union Select distinct code3 from datatable union Select distinct code4 from datatable
The union operator automatically removes duplicates (at least it does in MS SQL) > -----Original Message----- > From: Claremont, Timothy [mailto:[EMAIL PROTECTED] > Sent: Thursday, February 16, 2006 11:29 AM > To: CF-Talk > Subject: Getting Distinct Values across multiple fields > > I have a database that contains fields such as the following: > > Code1, Code2, Code3, Code4, Code5..... Code25. > > > I need to return the distinct codes from ALL columns. I don't > care if a > code only appeared in one of the columns, I need to see it in the > distinct list. > > I know that I could return a distinct list of EACH field, and then add > all of those together and get a distinct list of the result, but is > there a more elegant way to do this? > > CF7 and Access2k2 This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. A1. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232581 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54