Reputation: 119
I need help revising the query below. I'm trying to create a table like this:
| Jan 2014 | Feb 2014 |
| 7.5 | 8 |
But I end up getting this:
| Jan 2014 |
| 7.5 |
| 8 |
Is there a way to join these two (possibly more) queries into columns instead of rows? I'm using MS Access by the way. Thank you in advance.
My Current Query:
SELECT * FROM
(SELECT AVG([Length of Service in Years including Partial Year]) AS Jan2014
FROM [January 2014 HC] AS A)
UNION ALL
(SELECT AVG([Length of Service in Years including Partial Year]) AS Feb2014
FROM [February 2014 HC] AS B)
Thanks NoDisplayName for the answer, I think I got it!
EDIT:
SELECT * FROM
(SELECT AVG([Length of Service in Years including Partial Year])
FROM [January 2014 HC] AS A) AS Jan2014,
(SELECT AVG([Length of Service in Years including Partial Year])
FROM [February 2014 HC] AS B) AS Feb2014
Upvotes: 0
Views: 31
Reputation: 93694
Since both the queries going to return only one row you can do this.
select
(SELECT AVG([Length of Service in Years including Partial Year])
FROM [January 2014 HC]) AS Jan2014 ,
(SELECT AVG([Length of Service in Years including Partial Year])
FROM [February 2014 HC]) AS Feb2014
Upvotes: 3