X
Xmas
Hi, I have a series of queries which get data aggregated by year, e.g.
select year(date), min(var1), avg(var1), max(var1) from table where
(ridiculously complicated set of conditions) group by year(date)
select year(date), min(var2), avg(var2), max(var2) from table where
(entirely different ridiculously complicated set of conditions) group by
year(date)
etc etc
There are six queries like this so what I want is to amalgamate these
columns together into one results table (and also into one query so
users can just run one stored query rather than six!) as follows:
year, min(var1), avg(var1), max(var1), min(var2), avg(var2), max
(var2)...
I would have thought this is an area where a join would be effective,
but I am being defeated by Access' syntax. Have to admit I've been away
from SQL for some years and am a bit rusty! Any thoughts?
Cheers
select year(date), min(var1), avg(var1), max(var1) from table where
(ridiculously complicated set of conditions) group by year(date)
select year(date), min(var2), avg(var2), max(var2) from table where
(entirely different ridiculously complicated set of conditions) group by
year(date)
etc etc
There are six queries like this so what I want is to amalgamate these
columns together into one results table (and also into one query so
users can just run one stored query rather than six!) as follows:
year, min(var1), avg(var1), max(var1), min(var2), avg(var2), max
(var2)...
I would have thought this is an area where a join would be effective,
but I am being defeated by Access' syntax. Have to admit I've been away
from SQL for some years and am a bit rusty! Any thoughts?
Cheers