H
hbulsara
Hi,
Hope someone can help me with this. I'm trying to simulate the results
from full outer join in Access across 3 tables using a union query
that someone recommended (or another method if it can be done):
--TABLES--
BOE
INDICES
TECHNICALS
The common field among them is a date field in the fisrt column but
the tables differ in terms of both the number of rows (dates) they
have and also the number of columns/fields. Hence I want to bring back
all rows from all three tables even those that are unmatched by the
date field, but I want to join by date field across the tables so
where there is a match, the data is aligned by the date field. I've
been told I need to use a union query to do this but I am having
problems.
A little background - basicly I'm regulary importing 3 CSV files into
Access and the number of feilds in each file changes with each import
(two of the tables as about 35 feilds). I am now trying to find a way
to consolidate the three files into one (which is the whole reason for
importing into access), and using the date feild as the basis to align
the data from the three files. However in my final file I need to see
all columns from the three tables along with all dates, not just where
there is a match in date accross all three.
I ran the query below, but it generates a message saying that the
"number of columns in the tables does not match. But I thought the
whole point of a union query was to allow this! But I've never really
used SQL for Access (only oracle at basic level) so not sure if the
syntax is right.
Hope someone can shed some light or suggest an alternative approach
for what I need to do. I was thinking would creating a new table using
data from the three tables using SQL allow me to get the output I
need?
Thanks
Lucas
SELECT *
FROM
BOE LEFT JOIN indices ON bedmate=indices.date
UNION select *
from
technicals LEFT JOIN boe ON technicals.date=boe.date;
Hope someone can help me with this. I'm trying to simulate the results
from full outer join in Access across 3 tables using a union query
that someone recommended (or another method if it can be done):
--TABLES--
BOE
INDICES
TECHNICALS
The common field among them is a date field in the fisrt column but
the tables differ in terms of both the number of rows (dates) they
have and also the number of columns/fields. Hence I want to bring back
all rows from all three tables even those that are unmatched by the
date field, but I want to join by date field across the tables so
where there is a match, the data is aligned by the date field. I've
been told I need to use a union query to do this but I am having
problems.
A little background - basicly I'm regulary importing 3 CSV files into
Access and the number of feilds in each file changes with each import
(two of the tables as about 35 feilds). I am now trying to find a way
to consolidate the three files into one (which is the whole reason for
importing into access), and using the date feild as the basis to align
the data from the three files. However in my final file I need to see
all columns from the three tables along with all dates, not just where
there is a match in date accross all three.
I ran the query below, but it generates a message saying that the
"number of columns in the tables does not match. But I thought the
whole point of a union query was to allow this! But I've never really
used SQL for Access (only oracle at basic level) so not sure if the
syntax is right.
Hope someone can shed some light or suggest an alternative approach
for what I need to do. I was thinking would creating a new table using
data from the three tables using SQL allow me to get the output I
need?
Thanks
Lucas
SELECT *
FROM
BOE LEFT JOIN indices ON bedmate=indices.date
UNION select *
from
technicals LEFT JOIN boe ON technicals.date=boe.date;