By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,066 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

ASp/SQl not selecting properly

100+
P: 347
I have the following sql statement in my asp page
Expand|Select|Wrap|Line Numbers
  1. yaketyQuery="SELECT * FROM celebs INNER JOIN mp3 ON celebs.idnumber = mp3.celebid where (mp3.voicetypea or mp3.voicetypeb or mp3.voicetypec or mp3.voicetyped or mp3.voicetypee or mp3.voicetypef or mp3.voicetypeg or mp3.voicetypeh or mp3.voicetypei or mp3.voicetypej or mp3.voicetypek or mp3.voicetypel or mp3.voicetypem or mp3.voicetypen or mp3.voicetypeo = '" &voiceid& "') and celebs.idnumber =" &actorid& " order by mp3.orderno"
  2. Set yaketyRecordset=yaketyConnection.execute(yaketyQuery)
the problem i am having is that i am returning all mp3 files and not just the ones that have the voiceid selected in any of the fields

any ideas anyone
May 4 '11 #1

✓ answered by Rabbit

You can't do it that way, you need to specify the condition each time.
"mp3.voicetypen = '" &voiceid& "' or mp3.voicetypeo = '" &voiceid & "'"

Or, alternatively, you can use the IN operator.

Share this Question
Share on Google+
1 Reply


Rabbit
Expert Mod 10K+
P: 12,369
You can't do it that way, you need to specify the condition each time.
"mp3.voicetypen = '" &voiceid& "' or mp3.voicetypeo = '" &voiceid & "'"

Or, alternatively, you can use the IN operator.
May 4 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.