Hi, Let's say I have a table with col1 and col2 and a statement like the this
select (col1+col2) as col_new, (col_new+col1) as col_new2,.... FROM table
why the sql cannot recognized the newly computed col_new? I believe in mysql that works fine. In my situation, the col_new is much more complicated than the simple col1+col2, but I want to reuse that as a standing point instead of recalculating for every new column. Is there a direct way of doing this without using derive query because I have many calculated columns on the fly?
Hi visakh16, I understand you can do that, but the problem is I have too many computations that I need to do. Each derive from the other, if I have to add a new layer to each the code just becomes very confusing.
Hi visakh16, I understand you can do that, but the problem is I have too many computations that I need to do. Each derive from the other, if I have to add a new layer to each the code just becomes very confusing.
you've to either add a new layer or repeat calculation as it is. You cant use aliases directly in same level
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/