Running an SQL Statement with a GROUP BY Clause

  • Thread starter Thread starter nouveauricheinvestments
  • Start date 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?
 
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).
 
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.
 
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...
 
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...
 
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
 
Back
Top