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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting SQL statement to work: <> [multiple ids] 1

Status
Not open for further replies.

snowboardr

Programmer
Feb 22, 2002
1,401
PH
strSQL = &quot;SELECT * FROM quiz WHERE quizID=&quot; & QuizID & &quot; AND qID <> (3, 4) ORDER BY Rand() LIMIT 0,1&quot;

I can't seem to get it to elimitated multiple ids:
qID <> (3, 4)

Any ideas?

- Jason
www.vzio.com
ASP WEB DEVELOPMENT



 
That's because the &quot;not equals&quot; operator doesn't work the way you think it does. The right-hand side of &quot;<>&quot; must be a single value.

You should either do:

qID <> 3 AND qID <> 4


or

qID not in (3,4) ______________________________________________________________________
TANSTAAFL!
 
Thanks sleipnir214, the second one worked perfect, I tried it like that, but I guess it was slightly different, cause it wasn't working.

Thanks

Jason www.vzio.com
ASP WEB DEVELOPMENT



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top