Others will probably come up with a better way, but my first thought was a series of unions.
SELECT DISTINCT values FROM ( SELECT DISTINCT v1 AS values FROM table UNION SELECT DISTINCT v2 AS values FROM table UNION SELECT DISTINCT v3 AS values FROM table ) -------------- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA "C code. C code run. Run code run. Please!" - Cynthia Dunning ...-----Original Message----- ...From: Dennis Powers [mailto:[EMAIL PROTECTED] ...Sent: Friday, January 07, 2005 8:01 AM ...To: CF-Talk ...Subject: SQL Query Question ... ...We are using CF5.x and MSSQL server and I have a particular conundrum I ...am ...hoping one of you SQL experts can assist with. ... ...I have a record set like so: PN, V1, V2, V3...V15 Each "V" field ...contains a ...numeric value for each record. So a short record set might look ...something ...like: ... ...PN, V1, V2, V3 ...A 120 240 460 ...B 120 220 440 ...C 220 460 480 ...D 240 460 120 ... ...I need to query the database and come up with a result set of unique ...values ...for ALL the "V" fields across all records. So using the example above ...the ...optimum result would be a query with the result that would be: ... ...120 ...220 ...240 ...440 ...460 ...480 ... ...I would like to let the database do the work instead of doing it in CF ...with ...loops but I am out of my depth on this particular query set. Any ...assistance ...would be appreciated. ... ... ...Best Regards, ... ...Dennis Powers ...UXB Internet- A Website Design and Hosting Company ...690 Wolcott Road - P.O. Box 6028 ...Wolcott, CT 06716 tel: (203)879-2844 ...http://www.uxbinternet.com ...http://dennis.uxb.net ... ... ... ... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189655 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