Hello all,
I have a table with some IDs. A group of IDs is 777 and the rest are all different. Each ID has an associated amount with it. I want to generate the sum of amounts for all IDs with 777 and all the other IDs. So, I would end up with 2 aggregate amounts -
SUM of IDs 777
SUM of IDs not 777
Select iif(T.ID = 777,SUM(T.AMount),0) AS [SUm of 777], iif(T.ID <> 777,SUM(T.AMount),0) AS [SUm of Not 777]
From TransactionReport T
I haven't been able to run the query because it states - amount is not an aggregate function. I know it can be added, but its just messing up somewhere.
Thanks for reading!
I have a table with some IDs. A group of IDs is 777 and the rest are all different. Each ID has an associated amount with it. I want to generate the sum of amounts for all IDs with 777 and all the other IDs. So, I would end up with 2 aggregate amounts -
SUM of IDs 777
SUM of IDs not 777
Select iif(T.ID = 777,SUM(T.AMount),0) AS [SUm of 777], iif(T.ID <> 777,SUM(T.AMount),0) AS [SUm of Not 777]
From TransactionReport T
I haven't been able to run the query because it states - amount is not an aggregate function. I know it can be added, but its just messing up somewhere.
Thanks for reading!