Im trying to add data from tables into one table using this SQl below:
INSERT INTO myNewTable
SELECT *
FROM 2010-tbl, 2011-tbl, 2013-tbl
WHERE fldName = 'value';
All the tables have exactly the same structure - but different values in each. The first table(myNewTable) has no values and will accept all values inserted into it by the others. So how do i go about doing this? Do I need a JOIN statement of some sort?
EDIT
Just one thing - Im trying to remove at previous records in it before the insert - but MS Access is throwing this error:
Characters found after end of SQL statement
This is the code:
DELETE * FROM myNewTable
INSERT INTO myNewTable
SELECT * FROM 2012-tbl WHERE (((2012-tbl.[field])=[Text]));
Thanks
Use a Union
in your SELECT
Statement
INSERT INTO myTable
SELECT *
FROM 2010-tbl
WHERE fldName = 'value'
UNION
SELECT *
FROM 2011-tbl
WHERE fldName = 'value'
UNION
SELECT *
FROM 2013-tbl
WHERE fldName = 'value'