Re: I need help with selecting from 2 identical tables in 2 separate databases
Ok UPDATE:
We upgraded to MySQL 5.0 and I tried this, and this also failed to
function:
[SQL]
DROP TABLE /*! IF EXISTS */ AllStudents.spr ing_summer;
CREATE TABLE /*! IF NOT EXISTS */ AllStudents.spr ing_summer SELECT *
FROM OrigStudents.st udents LIMIT 1;
DELETE FROM AllStudents.spr ing_summer;
ALTER TABLE AllStudents.spr ing_summer ADD UNIQUE (unique_key);
INSERT INTO AllStudents.spr ing_summer SELECT * FROM Spring.Students
UNION SELECT * FROM Summer.Students ;
[/SQL]
This in MySQL 5.0 throws an error after only inserting one record:
I can't figure this out, it's literally due AM Monday; I've been at
this for a week now (it was due earlier this week) and I can't combine
two tables into 1 with unique data!
Phil
Ok UPDATE:
We upgraded to MySQL 5.0 and I tried this, and this also failed to
function:
[SQL]
DROP TABLE /*! IF EXISTS */ AllStudents.spr ing_summer;
CREATE TABLE /*! IF NOT EXISTS */ AllStudents.spr ing_summer SELECT *
FROM OrigStudents.st udents LIMIT 1;
DELETE FROM AllStudents.spr ing_summer;
ALTER TABLE AllStudents.spr ing_summer ADD UNIQUE (unique_key);
INSERT INTO AllStudents.spr ing_summer SELECT * FROM Spring.Students
UNION SELECT * FROM Summer.Students ;
[/SQL]
This in MySQL 5.0 throws an error after only inserting one record:
Duplicate entry 'asdfasdf' for key 1
this for a week now (it was due earlier this week) and I can't combine
two tables into 1 with unique data!
Phil
Comment