Thanks. I understand what you're saying. I couldn't get the suggested query to complete until I indexed the email field, but now it's pretty quick.
Jim ----- Original Message ----- From: "Matthew Walker" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Monday, January 27, 2003 3:24 PM Subject: RE: Problem with DISTINCT() > DISTINCT is not a function with parameters. It works on all the selected > data. > > Try this: > > SELECT DISTINCT email, ( > SELECT TOP 1 [name] > FROM table1 AS table1a > WHERE email = table1.email > ) AS myName > FROM table1 > WHERE status = 'A' > AND email <> '' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

