![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a query, which selects three columns from an inner join. The last two columns are SUM and the first one is GROUP BY. Now, I would like to add another column that will be the multiplication of the second and third columns. I have tried many ways but I am not very sure if what I have come up with is the best approach. Could someone suggest what would be the best way to achieve something like this? |
#3
| |||
| |||
|
|
Could you post your query first, along with table structures, sample data and desired output? Otherwse we'll be guessing what you are trying to achieve. Anyway, here's a guess: select i, sum(j), sum(k), sum(j) * sum(k) from x group by i -- HTH, Vyas, MVP (SQL Server) SQL Server Articles and Code Samples @ http://vyaskn.tripod.com/ "HLong" <HLong (AT) discussions (DOT) microsoft.com> wrote in message news:48F966FD-3B4B-4E5D-80AB-76734EB3826E (AT) microsoft (DOT) com... I have a query, which selects three columns from an inner join. The last two columns are SUM and the first one is GROUP BY. Now, I would like to add another column that will be the multiplication of the second and third columns. I have tried many ways but I am not very sure if what I have come up with is the best approach. Could someone suggest what would be the best way to achieve something like this? |
![]() |
| Thread Tools | |
| Display Modes | |
| |