February 13, 2004 at 11:27 am
I have two or more related tables that need to be combined as one e.g. i have Survey1, Survey2, Survey3 and i need to just combine all columns/data into one Survey table. How would i do that?
Thanks
February 13, 2004 at 12:54 pm
Create a table (newtable) containing all the necessary columns
insert newtable(columnthatapplies1,2,3,4,n)
select column1,column2,3,4,n
from Servey1
insert newtable(columnthatapplies1,2,3,4,n)
select column1,column2,3,4,n
from Servey2
insert newtable(columnthatapplies1,2,3,4,n)
select column1,column2,3,4,n
from Servey3
February 13, 2004 at 1:44 pm
OR
select column1,column2,3,4,n
from Survey1
UNION ALL
select column1,column2,3,4,n
from Survey2
UNION ALL
select column1,column2,3,4,n
from Survey3
* Noel
February 13, 2004 at 1:56 pm
i am trying to avoid this approach since each table has about 500 columns ,, there gotta be some more automated way of doing this?
February 13, 2004 at 1:59 pm
if you open QA and DRAG & DROP the Colums Folder into the Editor the Field List gets created for you. It doesn't get better than that
* Noel
February 16, 2004 at 4:56 am
I think that following script would help you..
SELECT *
INTO <NEW TABLE NAME>
FROM <TABLE 1>
INSERT INTO <NEW TABLE NAME>
SELECT *
FROM <TABLE 2>
INSERT INTO <NEW TABLE NAME>
SELECT *
FROM <TABLE 3>
February 16, 2004 at 8:14 am
I am afraid that is not going to work lakshman. The tables referred to have some of the same columns in them and some different.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply