Two Tables

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two tables the fields names are identical, the difference is one table is this years data and the second is last years data. How can I query these tables that results in all the data from both tables
 
Hi,


You should have just one table, with a field for the year, if you don't
already have a date_time field.


It is not lost, but may be slower. Build the query:


SELECT 2003 as TheYear, field1, field2, fiedl3, .... FROM table2003
UNION ALL
SELECT 2002, field1, field2, fiedl3, .... FROM table2002

and save it. Use that query, rather the original tables. Since you can't
build an index on a query, that may be slower than if it was a table, but
otherwise, it works, technically.



Hoping it may help,
Vanderghast, Access MVP



Iceman said:
I have two tables the fields names are identical, the difference is one
table is this years data and the second is last years data. How can I query
these tables that results in all the data from both tables
 
Hi Iceman,


From the help facility, do a search UNION.

That said, it's not common strategy to have two or more tables that are
exactly the same, one reason not to do it is you may find the need to
combine them in the future.

How about storing all years' data in one table with an additional date/time
field?? Especially since you obviously need to combine them (i.e. from your
question). The next you would probably want is to combine 3, 4, 5 etc...
years.

HTH,
Immanuel Sibero




Iceman said:
I have two tables the fields names are identical, the difference is one
table is this years data and the second is last years data. How can I query
these tables that results in all the data from both tables
 
Back
Top