Running an SQL Statement with a GROUP BY Clause

  • Thread starter nouveauricheinvestments
  • Start date
N

nouveauricheinvestments

Running an SQL Statement in Access

I'm trying to run the following query in access:

SELECT Average([Trade Data]![End Time]-[Trade Data]![Start Time]) AS
Duration, [Trade Data].Manager
FROM [Trade Data];
GROUP BY [Trade Data].Manager

It is giving me this error message:

The LEVEL clause includes a reserved word or argument that is
misspelled or missing, or the punctuation is incorrect.

What am I doing wrong?
 
B

Bob Barrows [MVP]

Running an SQL Statement in Access

I'm trying to run the following query in access:

SELECT Average([Trade Data]![End Time]-[Trade Data]![Start Time]) AS
Duration, [Trade Data].Manager
FROM [Trade Data]; <====
GROUP BY [Trade Data].Manager

It is giving me this error message:

The LEVEL clause includes a reserved word or argument that is
misspelled or missing, or the punctuation is incorrect.

What am I doing wrong?

Putting a semicolon at the end of your FROM clause (see the arrow
above).
 
J

John W. Vinson

Running an SQL Statement in Access

I'm trying to run the following query in access:

SELECT Average([Trade Data]![End Time]-[Trade Data]![Start Time]) AS
Duration, [Trade Data].Manager
FROM [Trade Data];
GROUP BY [Trade Data].Manager

It is giving me this error message:

The LEVEL clause includes a reserved word or argument that is
misspelled or missing, or the punctuation is incorrect.

What am I doing wrong?

Using the unrecognized function Average instead of the builtin Avg() operator,
for one thing. The excessive semicolon is probably a problem too.

You should probably also use the DateDiff() function to calculate the duration
instead of subtracting, unless you want the duration in fractional days.
 
N

nouveauricheinvestments

I'm still getting an error message...This is what I have...I just
copied and pasted...

SELECT Avg([Trade Data]![End Time]-[Trade Data]![Start Time]) AS
Duration, [Trade Data].Manager
FROM [Trade Data];
GROUP BY [Trade Data].Manager

Mind you, I don't really know what I'm doing, so that is probably the
problem...lol This is baptism by fire...
 
N

nouveauricheinvestments

I'm still getting an error message...This is what I have...I just
copied and pasted...

SELECT Avg([Trade Data]![End Time]-[Trade Data]![Start Time]) AS
Duration, [Trade Data].Manager
FROM [Trade Data];
GROUP BY [Trade Data].Manager

Mind you, I don't really know what I'm doing, so that is probably the
problem...lol This is baptism by fire...

oh crap...I thought you were saying I should put a semicolon there...I
removed it and it worked like a charm...
 
J

John Spencer

You still did NOT remove the semi-colon in the FROM line.

SELECT Avg([Trade Data]![End Time]-[Trade Data]![Start Time]) AS
Duration, [Trade Data].Manager
FROM [Trade Data]
GROUP BY [Trade Data].Manager


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 

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


Top