By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,398 Members | 1,075 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,398 IT Pros & Developers. It's quick & easy.

Joining tables

P: n/a
Hi, if i use two queries in brackets

(SELECT * FROM a)
(SELECT * FROM b)

where both tables have the same columns, but a has different data in a
column, can i merge them using SQL through a odbc driver to an access
datafile?

I.e.

In table a

Row 1
Field1 = David
Field2 = Florida
Field3 = ''

Row 2
Field1 = David
Field2 = NY
Field3 = ''

In table b

Row 1
Field1 = David
Field2 = Florida
Field3 = 01234 567 890

So as a result I would get a table with

Row 1
Field1 = David
Field2 = Florida
Field3 = 01234 567 890

Row 2
Field1 = David
Field2 = NY
Field3 = ''

If I did have to do this in 2 seperate querys, can I join these
together in msaccess sql through odbc. Im having trouble getting JOIN
or INTERSECT to work at the moment, do these work using SQL acess to a
access datafile?

Thanks in advance

David

Apr 26 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Try a UNION query, i.e.:
SELECT a.* FROM a
UNION ALL
SELECT b.* FROM b;

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"David" <da************@gmail.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
Hi, if i use two queries in brackets

(SELECT * FROM a)
(SELECT * FROM b)

where both tables have the same columns, but a has different data in a
column, can i merge them using SQL through a odbc driver to an access
datafile?

I.e.

In table a

Row 1
Field1 = David
Field2 = Florida
Field3 = ''

Row 2
Field1 = David
Field2 = NY
Field3 = ''

In table b

Row 1
Field1 = David
Field2 = Florida
Field3 = 01234 567 890

So as a result I would get a table with

Row 1
Field1 = David
Field2 = Florida
Field3 = 01234 567 890

Row 2
Field1 = David
Field2 = NY
Field3 = ''

If I did have to do this in 2 seperate querys, can I join these
together in msaccess sql through odbc. Im having trouble getting JOIN
or INTERSECT to work at the moment, do these work using SQL acess to a
access datafile?

Thanks in advance

David

Apr 26 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.