Database query

R

Raymondo

I have the following sql:
SELECT Sector, COUNT(Sector) as No
FROM Results
Group BY Sector

Where Sector is in my Results table. But i get a database results wizard
error: The SELECT statement includes a reserved word or an argument name
that is misspelled or missing, or the punctuation is incorrect.
Number: -2147217900 (0x80040E14)

It all looks ok to me but....... could do with some advice! Thanks.
 
J

Jon Spivey

Hi,
No is a reserved word. Try

SELECT Sector, COUNT(Sector) as NumSectors
FROM Results
Group BY Sector
or
SELECT Sector, COUNT(Sector) as [No]
FROM Results
Group BY Sector
 
R

Raymondo

Hi Jon,

That's nailed it! Thanks so much. Ray

Jon Spivey said:
Hi,
No is a reserved word. Try

SELECT Sector, COUNT(Sector) as NumSectors
FROM Results
Group BY Sector
or
SELECT Sector, COUNT(Sector) as [No]
FROM Results
Group BY Sector

--
Cheers,
Jon
Microsoft MVP

Raymondo said:
I have the following sql:
SELECT Sector, COUNT(Sector) as No
FROM Results
Group BY Sector

Where Sector is in my Results table. But i get a database results wizard
error: The SELECT statement includes a reserved word or an argument name
that is misspelled or missing, or the punctuation is incorrect.
Number: -2147217900 (0x80040E14)

It all looks ok to me but....... could do with some advice! Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Database wizard problems 2
Database Interface Wizard 3
UPDATE 2
Union query 5
DBI update failure 8
Database Interface Wizard 6
DBRW Issue - Syntax Error 11
Database Update 16

Top