Just a guess, but you might want to go with DISTINCT as well as some
parentheses near your LIKE statments.  Something along the lines of...

WHERE       Products.ItemID = ProdPics.PicID
AND   (Description LIKE '%#form.keyword#%' OR ItemName LIKE
'%#form.keyword#%')
AND   ItemID > 1
ORDER BY ItemName


otherwise that OR might be throwing some wrenches in there...

HTH,

Evan


> -----Original Message-----
> From: Alan Koenig [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 12, 2001 2:21 PM
> To: CF-Talk
> Subject: Re: SQL Returns
>
>
> That did not help, now I am getting 14 returns for each record.
> Now I am in
> confusion.
> Is there another way for me to return just one record.  Do I need
> to refine
> my where clause?
> TIA
>
>
> ----- Original Message -----
> From: "Bob Silverberg" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Thursday, April 12, 2001 7:24 AM
> Subject: RE: SQL Returns
>
>
> > Well, one way it to use the DISTINCT keyword.  Change your
> statement from:
> >
> > SELECT Products.ItemID, etc.
> >
> > to
> >
> > SELECT DISTINCT Products.ItemID, etc.
> >
> > .... but I'm not sure if that will give you what you want.
> >
> > Give it a try and see what the result set looks like.
> >
> > Bob
> >
> > -----Original Message-----
> > From: Alan Koenig [mailto:[EMAIL PROTECTED]]
> > Sent: April 12, 2001 12:58 PM
> > To: CF-Talk
> > Subject: SQL Returns
> >
> >
> > I would like to refine my sql searches down.  From the following sql
> > statement I am recieving up to 12 returns of the same record.  How can I
> > make this so that there is only 1 return for each record?
> >  <cfquery datasource="#datasource#" name="prodpage">
> >  SELECT      Products.ItemID,
> >     Products.SKU, Products.ItemName,
> >     Products.CategoryID,
> >     Products.SubCatID,
> >     Products.S_Description,
> >     Products.Description,
> >     Products.Price,
> >     Products.Weight,
> >     Products.A1,
> >     Products.A1Vals,
> >     Products.A2,
> >     Products.A2Vals,
> >     Products.Units,
> >     Products.Layout,
> >     Products.Key_Word,
> >     ProdPics.PicID,
> >     ProdPics.ItemPic,
> >     ProdPics.ItemPicLB,
> >     ProdPics.ItemPicF,
> >     ProdPics.ItemPicB
> >  FROM        Products, ProdPics
> >  WHERE       Products.ItemID = ProdPics.PicID
> >  AND   Description LIKE '%#form.keyword#%'
> >  OR    ItemName LIKE '%#form.keyword#%'
> >  AND   ItemID > 1
> >  ORDER BY ItemName
> >  </cfquery>
> >
> > TIA
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to