November 18, 2009 at 3:27 pm
I want to Use expression value as column name in same query again
For eg:
select productname, (uprice+sprice) As pprice, CASE WHEN IsNull(pprice) Then '0' Else pprice End As pprice2 from products where active=1, productname is not null
Here pprice is the value I am calculating and want to be able to refer it in the same query without having to write the calculation again. This is just a simple example but the actual calculated column is complicated and very long and it makes it very difficult to debug if I have to use the same code again and again. Is there a cleaner way to do this in same query?
November 18, 2009 at 3:43 pm
Please don't cross-post.
conversation is already ongoing over here:
http://www.sqlservercentral.com/Forums/FindPost821231.aspx
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply