D
djc
Below is a copy/paste of my original post. I got one reply and I realize it
is ok to have a query based on a query from that reply. However, I still
want to know if I can do this with one query. And if so, how? I would rather
do things with one query whenever possible for a few reasons, one of them
being I want to learn the SQL syntax, another being that if I get it into
one query than I am more likely able to use that same sql with things other
than access. More portable, if you will. Heres the original post agian:
I have an existing query that already contains a calculated field that uses
the sum() aggregate function. From a table with 1 or several entries for a
particular Item containing start and stop times it sums the total time taken
per Item (each record has an ItemID, ItemType, ItemMake, Start, and Stop
field). So I am already using the sum() function to do this. However, now I
need to get the average time recorded grouped by ItemType.
So, as succinctly put as possible, I need to use the sum() function grouping
by the particular ItemID to get the TotalTime for each individual item. I
have this already. I then need to find the average TotalTime by ItemType.
How can I do this with one query? Do I need to use a sub query? I prefer
using one query if possible as if I understand correctly, that is preferable
over linking several query objects together. ie. SELECT * FROM qrySavedQuery
INNER JOIN tblTableName etc...
is ok to have a query based on a query from that reply. However, I still
want to know if I can do this with one query. And if so, how? I would rather
do things with one query whenever possible for a few reasons, one of them
being I want to learn the SQL syntax, another being that if I get it into
one query than I am more likely able to use that same sql with things other
than access. More portable, if you will. Heres the original post agian:
I have an existing query that already contains a calculated field that uses
the sum() aggregate function. From a table with 1 or several entries for a
particular Item containing start and stop times it sums the total time taken
per Item (each record has an ItemID, ItemType, ItemMake, Start, and Stop
field). So I am already using the sum() function to do this. However, now I
need to get the average time recorded grouped by ItemType.
So, as succinctly put as possible, I need to use the sum() function grouping
by the particular ItemID to get the TotalTime for each individual item. I
have this already. I then need to find the average TotalTime by ItemType.
How can I do this with one query? Do I need to use a sub query? I prefer
using one query if possible as if I understand correctly, that is preferable
over linking several query objects together. ie. SELECT * FROM qrySavedQuery
INNER JOIN tblTableName etc...