Trying to Use Case Statement Results

I have used a case statement to anaalyze data and show them in a table column.

(CASE
WHEN Status = "A" THEN ""
WHEN Status = "Gm3" THEN GM1+GM2
ELSE GM1+GM2+GM3
END) AS "Case1 "

How can I sum the values from this case to a "running total"?

try this

Select SUM(CASE1) as [running total] from (
Select status
,Gm1
,Gm2
,Gm3
,GmCnt
,TOTAL
,RSum
,case status
when 'A' then ''
when 'Gm3' then GM1+GM2
ELSE GM1+GM2+GM3
END AS 'CASE1' from #temp) a

Hello

Thanks for your input!

Have tried this with few variations but could not get past this error?

Included a jpg of MySQL code and error msg for clarity.

Have not used many case statements or square brackets very often but like the possibilities.

Ray

This is a Microsoft SQL Server forum, so you might not find people here familiar with MySQL ...

Pretty sure they don't work in MySQL ...

Thanks for info.