Thanks Deanna.  Not exactly what I wanted (my fault for not explaining
properly) but you got me on the right tracks :)

Cheers

Will
----- Original Message -----
From: "Deanna Schneider" <[EMAIL PROTECTED]>
Newsgroups: cf-talk
Sent: Tuesday, September 25, 2001 7:05 PM
Subject: Re: AND & OR placement in SQL


> Depends on what you want it to do. Right now, it's saying, select this
stuff
> if town is the same as the form.towny  AND category is form.category OR
> select this stuff if natpaid is yes and nationwide is yes AND category is
> form.category.
>
> My guess is that what you want is:
> select this stuff if town is the same as the form.towny OR select this
stuff
> if natpaid is yes and nationwide is yes AND category is form.category.
>
> If that's what you want, you need a little different query. Try this:
>
> <cfquery cachedwithin="#createtimespan(0,0,10,0)#" name="getads"
> datasource="#DSN#">
> SELECT left(subject,20) as newsubject, * FROM advert_details
> WHERE town = '#form.towny#'
> <cfif isdefined('form.category')>
> OR (natpaid = Yes AND nationwide = Yes
> AND category = '#form.category#')
> <cfelse>
> OR (natpaid = Yes AND nationwide = Yes)
> </cfif>
> </cfquery>
>
> Make sense?
> -Deanna
>
>
> Deanna Schneider
> Interactive Media Developer
> [EMAIL PROTECTED]
>
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to