Why does the following sql code gives a syntax error in Access? How can I fix it?
Code:SELECT SUM(CASE WHEN City = 'Sandnes' THEN 1 ELSE 0 END) as FieldNeeded1 FROM Persons;
Why does the following sql code gives a syntax error in Access? How can I fix it?
Code:SELECT SUM(CASE WHEN City = 'Sandnes' THEN 1 ELSE 0 END) as FieldNeeded1 FROM Persons;
Try this instead:-
Code:SELECT Sum(IIf([City]='Sandnes',1,0)) AS Sum FROM Persons;