Jump to content


Photo

how many conditions are allowed to set after WHERE ?


  • Please log in to reply
3 replies to this topic

#1 adwfun

adwfun
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 15 September 2006 - 05:22 AM

I made a Select.....Where... query with over 10 conditions after Where. It returned with a syntax error and I am wondering if there is a maximum conditions allowed.

I did that because I setup 5 dropdown menu to let user choose and then submit to get data, and there are 8 tables required in Select....

Please kindly advise.
Thanks ???

#2 btherl

btherl
  • Staff Alumni
  • Advanced Member
  • 3,893 posts
  • LocationAustralia

Posted 15 September 2006 - 08:35 AM

There's no limit (in theory), but huge queries can hit resource limits sometimes.  Can you post your query and the error message?

#3 ale1981

ale1981
  • Members
  • PipPipPip
  • Advanced Member
  • 65 posts

Posted 15 September 2006 - 10:42 AM

Try putting the WHERE conditions inside (), like;

SELECT * FROM table WHERE (a=1, b=2, c=3, d=4)



#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 15 September 2006 - 12:47 PM

You can place parentheses, to be sure, but you'll have to use AND / OR, not commas.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users