Joel, "distinct" and "all of the columns" are somewhat mutually exclusive - unless you have lots of duplicate rows. If you do have duplicate rows, but you have a Primary key set, then selecting distinct on everything will have no effect (since the PK makes the row automatically unique. You could also try excluding the PK and using a group by:
SELECT DISTINCT IPAddress, ....list of other columns minus PK..., count(IPAddress) AS total from stats0301 WHERE DomainID = '43' AND SameDayDate = '20030128' Group by IPAddress, ... plus other columns.... Oder by Total , .... plus any remaining columns.... -mk -----Original Message----- From: Joel Blanchette [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 06, 2003 12:29 PM To: CF-Talk Subject: SQL Question (Distinct) I am trying to do a query as follows Now I need the IPAddress to be DISTINCT but I need to return all the columns. What would I do to accomplish this? Thanks ============================== Joel Blanchette IT and System Specialist Point of Impact Technologies Inc. Tel: (204) 989-0013 Email: [EMAIL PROTECTED] ============================== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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

