Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Multiple IF statements in SQL SELECT statement
Old 10-21-2005, 01:41 PM Multiple IF statements in SQL SELECT statement
pjb007's Avatar
Super Talker

Posts: 104
Location: UK
Trades: 0
I am having problems getting an IF statement to work, can you have an IF statement on a line like below

Code:
sSQL="SELECT * FROM asplinks WHERE a=true AND b=true"
The bits in bold will change in the IF variants, so there will be:

True - True
True - False
False - True
False - False

and there will be one final line with out the WHERE bit.

Its been such a long time since I used SQL
__________________
pjb007
pjb007 is offline
Reply With Quote
View Public Profile Visit pjb007's homepage!
 
 
Register now for full access!
Old 11-14-2005, 08:48 PM
Bullschmidt's Avatar
Average Talker

Posts: 24
Location: USA
Trades: 0
Not totally sure of what you're getting at but this example should work (assuming that a and b are names of fields in the database):

Code:
sSQL="SELECT * FROM asplinks WHERE ((a=true) AND (b=true)) OR ((a=false) AND (b=false))"
__________________
J. Paul Schmidt

Please login or register to view this content. Registration is FREE
- Freelance Web and Database Developer

Please login or register to view this content. Registration is FREE
- Classic ASP Design Tips
Bullschmidt is offline
Reply With Quote
View Public Profile Visit Bullschmidt's homepage!
 
Reply     « Reply to Multiple IF statements in SQL SELECT statement
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09207 seconds with 12 queries