Just add 'DISTINCT' after 'SELECT' and SQL Server will automatically ensure that you don't have any duplicate rows in your result set. Oh, and go check out CFQUERYPARAM and use it. It'll save you lots of headaches.
cheers, barneyb On Tue, 04 Jan 2005 21:04:20 -0400, Will Tomlinson <[EMAIL PROTECTED]> wrote: > Hello, > > I'm working with a clothing database. ProdID is the PK, then I have > prodmodelnumber, prodcategory, etc..etc.. > > Clothes with the same model number have different sizes and colors so there > will be quite a few duplicate model numbers in this table. I'm passing the > usual URL parameter for the category to the query. How can I group this so > there'll be only distinct model numbers shown? > > I made it work by using <cfoutput group="prodmodelcode">, but I was trying to > keep the burden on SQL Server. Also, I'm going to convert the cfquery to a > stored procedure, can I handle this with T-SQL? > > Thanks, > Will > > <cfparam name="URL.CAT" default="1"> > <cfquery name="getprodsbycategory" datasource="#DSN#"> > SELECT prodID, prodmodelcode, prodtitle, prodcategory, prodsellprice > FROM dbo.tblproducts > WHERE prodcategory = '#URL.CAT#' > </cfquery> > -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 9 invites. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Protect your mail server with built in anti-virus protection. It's not only good for you, it's good for everybody. http://www.houseoffusion.com/banners/view.cfm?bannerid=39 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189331 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

