Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where clause problems

Status
Not open for further replies.

link9

Programmer
Nov 28, 2000
3,387
US
I need to select a recordset from an access database (with asp - vbscript) where a certain field (SVP) can equal several different things, but not necessarily contiguous. Below is the flawed select statement I have. If anyone can correct it for me, I would GREATLY appreciate it.


"select * from demographics where SVP = 51 or SVP = 53 or SVP = 56 and VPO = 65"

I'm fairly new at sql, so please help!

Thank you,
Paul Prewett
 
The best thing to do is use brackets, because the AND has a greater binding power than the OR statements.
What you are issuing is:

Code:
"select * from demographics where SVP = 51 or SVP = 53 or (SVP = 56 and VPO = 65)"

James :) James Culshaw
jculshaw@active-data-solutions.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top