|
-
May 6th, 2003, 09:31 AM
#1
SQL query
Hi,
I want to know if it's possible to use together bot AND and OR operators in a SQL statement, and if it is, how?
It's for an advanced search, and some fields work has a OR, and the others work has a AND.
Ex: Field1, Field2, Field3, Field4
Field1=text AND Field2=text AND (Field3=text OR Field4=text),
is this possible???
-
May 6th, 2003, 09:41 AM
#2
Yes. Use parentheses to set your precedence order ... Just as you did in your example
-
May 7th, 2003, 06:24 AM
#3
If you do without the parenthsis like this
Field1=text AND Field2=text AND Field3=text OR Field4=text
it would be ran as though you did this
(Field1=text AND Field2=text AND Field3=text) OR Field4=text
so it is better to qualify your sections to ensure the right outcome.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|