Re: AND OR placement in SQL

2001-09-26 Thread W Luke
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

RE: AND OR placement in SQL

2001-09-25 Thread Costas Piliotis
When using funky and and or clauses in the where clause, it's a really good idea to use parenthesis to control the flow. It won't muck up the query, but you may not necessarily get the results you want... -Original Message- From: W Luke [mailto:[EMAIL PROTECTED]] Sent: Monday,

RE: AND OR placement in SQL

2001-09-25 Thread Steven Monaghan
My suggestion when mixing AND OR is to wrap everything in parentheses. This way there can be no confusion. SELECT left(subject,20) as newsubject, * FROM advert_details WHERE ( town = '#form.towny#' OR ( natpaid = Yes AND nationwide =

Re: AND OR placement in SQL

2001-09-25 Thread Deanna Schneider
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