473,401 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Concatenating many tables

3
I am a new Access use and need to concatenate (UNION) many tables. I am currently doing it "by hand":

SELECT *
FROM [TestA]


UNION SELECT * FROM [TestB];
UNION SELECT * FROM [TestD];
.....
UNION SELECT * FROM [TestX];

I would like to do this with a loop where I can specify TestA, TestB, .... TestX.
The table names are abitrary, not Table1, Table2....

Any help would be greatly appricated.

Thanks
Oct 24 '08 #1
5 1488
NeoPa
32,556 Expert Mod 16PB
Is this simply to display or do you want to move (APPEND) the data somewhere?

How do YOU determine which tables are to be included (List, String, Table, All tables in database)?
Oct 24 '08 #2
davec4
3
Is this simply to display or do you want to move (APPEND) the data somewhere?

How do YOU determine which tables are to be included (List, String, Table, All tables in database)?
I want to export the table as an Excel spreadsheet. I can generate the list of tables in a driver table.
Oct 24 '08 #3
NeoPa
32,556 Expert Mod 16PB
Exporting the results is another question entirely. We can handle that, but not here & now as we are looking at something else.

What is a "driver table"?
Oct 24 '08 #4
davec4
3
Exporting the results is another question entirely. We can handle that, but not here & now as we are looking at something else.

What is a "driver table"?
A table containing the names of the files to be appended.


In a generic sense I want to do the following:

select *
from TableA

do name="TableB","TableD",......"TableX"
union select *
from name;
end;

Hope that makes it simpler.

Thanks
Oct 24 '08 #5
NeoPa
32,556 Expert Mod 16PB
Well, that's fairly straightforward then.

The SQL needs to be built up into a string. You need a code-loop that processes through the table (Use recordset processing - Basic DAO recordset loop using two recordsets).

When the loop has terminated whip off the starting UNION ALL (rather than a simple UNION unless you want to lose any potential duplicates) and you should be left with the main part of your SQL string. Tidy it up and you have what you need.
Oct 25 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: foodic | last post by:
i am fresher to C++ programming, and I just want to learn Concatenating Calls, I have written a program, class SetMe { public: void setX(int x) {_x = x;} void setY(int y) {_y = y;} void...
4
by: Juan | last post by:
Does any one know if there are reported bugs when concatenating strings? When debugging each variable has the correct value but when I try to concatenate them some values are missing (I canīt see...
0
by: bob brar | last post by:
hi, I have the following function in a class. Public Function getCustomers() As DataSet Dim Db As New CDatabaseAccessor getCustomers = Db.getData("SELECT A.*, RTRIM( A.TITLE)+', '+ RTRIM...
4
by: Elena | last post by:
Hi, I am filling in a combobox. I would like to concatenate two fields into the data combo box and display "last name, first name" I tried to displaymember = "employee_last_name" & ", " &...
4
by: James Conrad StJohn Foreman | last post by:
I've got a table full of search terms, one search term per row. ID CATEGORYID SEARCH_TERM 1 1 cat 2 1 mat 3 2 sat .... I need to get the search terms concatenated - is there an...
7
by: Mary | last post by:
I have a student who has a hyphenated first name. If I concatenate the name like this: StudentName:( & ", " & ), it works as expected. If, however, I try to get the first name first by...
3
by: Raju | last post by:
I am using CDO.Message to create an email. Currently the email sent says the email id of the sender however i would like it to say the name + email id something like this Email From : "...
0
by: NooK | last post by:
I have a few tables tables, one of which has a column which contains part of the name of the other tables. So basically I am trying to get this half name by running SELECT subName FROM table_1...
2
by: Whizzo | last post by:
Hi all; I'm using this great bit of code to concatenate a fields from multiple rows into a single one. 'Concat Returns lists of items which are within a grouped field Public Function...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.