Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

access sql syntax error

Status
Not open for further replies.

SMAlvarez

Programmer
Dec 4, 2005
27
US
As for I know this is a valid sql statement, but for some reason access gives me a syntax error. How can I fix it? Thanks.

SELECT SUM(CASE WHEN City = 'Sandnes' THEN 1 ELSE 0 END) as FieldNeeded1
FROM Persons;
 
Hi

The Access equivalent would be:-

Code:
select sum (iif (city = 'Sandnes', 1, 0)) as fieldneeded1
from persons;

pjm
 
...or
Code:
select count (*) as fieldneeded 
from persons
where city = 'Sandnes';

:)

pjm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top