Mike,
Thank you for the reply. The derived tables example is exactly what I was looking for. I just had to make one small syntax chage for it to execute properly:
SELECT qtrs.qtr1, qtrs.qtr2, qtrs.qtr1+qtrs.qtr2 AS firstHalf FROM (
SELECT SUM(jan+feb+mar) AS qtr1, SUM(apr+may+jun) AS qtr2 FROM myTable ) as qtrs
It looks like I have to use an alias name for the derived tabel. Thank you again for great suggestion!
Kind Regards,
Mat
>SQL Server won't give you the behavior that you're looking for. I can think of two ways to get the behavior that your looking for.
>
>1) Use views
>
>CREATE VIEW qtrs AS
>SELECT SUM(jan+feb+mar) AS qtr1, SUM(apr+may+jun) AS qtr2 FROM myTable
>
>SELECT qtr1, qtr2, qtr1+qtr2 AS firstHalf FROM qtrs
>
>2) Use derived tables
>
>SELECT qtr1, qtr2, qtr1+qtr2 AS firstHalf FROM (
> SELECT SUM(jan+feb+mar) AS qtr1, SUM(apr+may+jun) AS qtr2 FROM myTable )
>
>-Mike
>