Case and if statements using calculated fields
Posted by:
joe byers
Date: January 28, 2005 11:00AM
I need to use a calculated column from an if or case statement in a calculation in my select statement. For example,
select if(a.col1>5,1,2) as newcol, newcol1*b.col1 as newcol2 from table1 as a, table 2 as b;
SAS's sql interpreter allows you to use a keword in the select statement as
select if(a.col1>5,1,2) as newcol, calculated newcol1 *b.col1 as newcol2 from table1 as a, table 2 as b;
to let the sql interpreter know that newcol1 is a calculated column for the current row.
Is there a way to do this in MYSQL?
thank you
Subject
Written By
Posted
Case and if statements using calculated fields
January 28, 2005 11:00AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.