0

So I'm fairly new to SQL and I have a table (ID, GameDate, Result) where I'm trying to calculate total wins and losses.

I found this example and modified to my environment:

SELECT SUM(CASE WHEN Result = 'W' THEN 1 ELSE 0 END) as Wins, 
SUM(CASE WHEN Result = 'L' THEN 1 ELSE 0 END) as Losses 
FROM Table1;

I keep getting a syntax error on the SUM CASE section and the When being highlighted. I've tried removing the single quotes for double quotes, no luck.

Not sure exactly whats wrong or if there is a better way to sum the totals. Suggestions?

Muhnamana
  • 1,014
  • 13
  • 34
  • 57

0 Answers0