I have an SQL Statement:
SELECT a.SERVER, a.OFFICE, a.LOCATION, a.[Office Name],
a.[GL Code],
RecType = CASE a.AcctBal
WHEN >= 0 THEN 'D'
WHEN < 0 THEN 'C'
END,
a.CLOSEDATE,
0 AS BegTotBal,
0 AS BegRecBal,
SUM(a.AcctBal)
FROM tblAgings a
GROUP BY a.SERVER, a.OFFICE, a.LOCATION, a.[Office Name],
a.[GL Code], a.CLOSEDATE
I'm getting an error saying saying Incorrect syntax near the ">" sign.
I can't Group By the RecType column, I get the same error.
Is there a way to use CASE with GROUP BY in the manner above?
Any help would be appreciated.
SELECT a.SERVER, a.OFFICE, a.LOCATION, a.[Office Name],
a.[GL Code],
RecType = CASE a.AcctBal
WHEN >= 0 THEN 'D'
WHEN < 0 THEN 'C'
END,
a.CLOSEDATE,
0 AS BegTotBal,
0 AS BegRecBal,
SUM(a.AcctBal)
FROM tblAgings a
GROUP BY a.SERVER, a.OFFICE, a.LOCATION, a.[Office Name],
a.[GL Code], a.CLOSEDATE
I'm getting an error saying saying Incorrect syntax near the ">" sign.
I can't Group By the RecType column, I get the same error.
Is there a way to use CASE with GROUP BY in the manner above?
Any help would be appreciated.