At the end of my select statement I use a compute sum() to get a total. I want to assign the resultset from the compute sum() to a variable. I have tried this which does not work.
Declare @Total as int
select first_name, last_name, amount
from customer
Group by first_name, last_name, amount
select @Total = compute sum(amount)
This does not work. any suggestions are appreciated.
Thanks