Display similar information from 2 tables in one query

  • Thread starter FrustratedAssnt
  • Start date
F

FrustratedAssnt

I know I'm overlooking something stupid and simple. I have 2 tables with
similiar data, that need to be kept seperate.

However, in one SINGLE instance I need to display all the similar fields
together. I really want it to be a query, but I'll live with a report or
something. How do I do this?
 
J

John W. Vinson

I know I'm overlooking something stupid and simple. I have 2 tables with
similiar data, that need to be kept seperate.

Well... you'ld better have a REALLY REALLY good reason to keep them separate.
It's generally a very bad idea to "store data in a tablename".
However, in one SINGLE instance I need to display all the similar fields
together. I really want it to be a query, but I'll live with a report or
something. How do I do this?

A UNION query may be the solution, though I really don't know what you mean by
"all the similar fields together". UNION will string together two tables (or
queries) into one taller (not wider) table:

SELECT thisfield, thatfield, theotherfield FROM Table1
UNION <or UNION ALL>
SELECT thisfield, otherfield, yetanotherfield FROM Table2

UNION removes duplicates, UNION ALL leaves them in; the two SELECT clauses
must have the same number of fields and they must match in datatype, i.e. if
Table1.theotherfield is Date/Time, then Table2.yetanotherfield must also be
Date/Time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top