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?
nouveauricheinvestments@gmail.com wrote: > 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). -- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup.
On Mon, 13 Oct 2008 14:13:58 -0700 (PDT), nouveauricheinvestments@gmail.com wrote: >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. -- John W. Vinson [MVP]
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...
On Oct 14, 7:07 am, nouveauricheinvestme...@gmail.com wrote: > 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 nouveauricheinvestments@gmail.com wrote: > 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...