July 1, 2008 at 3:24 pm
"IF" doesn't work that way. "Where" does.
SELECT A, B, C
FROM table1
where var1 = 1
UNION
SELECT A, B, C
FROM table2
where var2 = 1
UNION
SELECT A, B, C
FROM table3
where var3 = 1
Edit: The declare and set statements are the same, I just didn't include them. And I'm assuming your actual query has correct variable names (with @ on them).
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 1, 2008 at 3:28 pm
oh duh, i should know that. Thanks for the help. I've been reading some of your other posts. You give out some good advice 😉
July 1, 2008 at 3:28 pm
You're welcome, and thank you for the kind words.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 3 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply