Web Development



How to I combine fields from two different tables

By cherritz ·
I have a table with Attendance Records from 2009 and a table with Attendance Records from 2010. Each table has a field called Times Tardy, Sick Days, Personal Hrs., etc. Our Perfect Attendance goes from October of 2009 to September of 2010. How can I create a query that I can choose any dates (ex. 10/01/2009 and then 09/30/2010) and have it pull the Times Tardy, Sick Days, and Personal Hrs from both Tables?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Union all

by Tony Hopkinson In reply to How to I combine fields f ...

Select .. From Table Where...
Union all
select .. from Table where..

The columns have to match in number and type, the names of them will be those in the first table.

If you want to then say order the resukt, then in access you'd name the union query and then select from that, in a full DBMS

you just do
Select * From (put union query in here) someusefulfor table
[Where ...]
[Order By ...]

Won't be so in your case, but if you have a record the same in both tables, thye would both end up in the result, if you didn't want that then use Union in stead of uinion all.

You can do mpre than two as well, just chain them togther.

Related Discussions

Related Forums