Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft SQL Server > IF within SELEC...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 11125 of 11517
Post > Topic >>

IF within SELECT

by carmelo <csaffi@[EMAIL PROTECTED] > Jun 9, 2008 at 03:17 PM

Hello,
I'm working on a DB on which I can run only SELECT commands, so I'd
like to modify these UPDATE commands, into one SELECT command, which
makes use of IF statements:

update Table
set field1=field2

update Table
set field1=field3
where 'condition'

I've modified it into this:
select *,
IF(condition,field3,field2)
END IF as newField
from Table

I tried this way too:
select *,
IF(condition) THEN field3
ELSE field2
END IF as newField
from Table


It doesn't work... I hope you can help me
Thank you very much in advance
Carmelo
 




 3 Posts in Topic:
IF within SELECT
carmelo <csaffi@[EMAIL  2008-06-09 15:17:02 
Re: IF within SELECT
"Plamen Ratchev"  2008-06-09 18:28:14 
Re: IF within SELECT
carmelo <csaffi@[EMAIL  2008-06-10 02:03:58 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 22:09:48 CST 2008.