My select statement starts as follows:
select Number, Number*2 as NumberTimes2 from Table1 ...
If I want NumberTimes2 to be 100 when Number*2 >= 100, how do I code this in the select statement? Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
All flavours of SQL allow a
CASEstatement (you haven’t stated which database you are using). Depending on your database, you may be able to do it in a briefer way (for example mysql’sifstatement)