SQL nested SELECT statement for column
Posted on 2010-11-23
I am trying to select a column inside of a SELECT statement that pulls vlaues out where a different column equals a value. This is an example of what I want to do but it is not correct:
SELECT column1, column2, (SELECT column 3 WHERE column6 <= 12 AND column10 >= 1 AS YearlySum), column 3, column4, column 5 FROM table1
As you can see I would like to select all of the columns from the table, but also select some of the columns based on certain conditions. Any hlep is greatly appreciated.