Hi!
The following is always a problem to me. I've asked about this before, but so far have no luck.
MySQL Version is 4.1.13.
I have two tables, let's say A and B. Table A has 150K records, Table B has 300K.
Both have unique index on field F1, F2, F3 (these fields are in both tables).
What I want to do is:
I want to insert records from Table B into Table A, only the records that are not yet in Table A
(so it could be all records in Table B).
I wrote:
insert into A
select B.*,
'','','' #Table A has more fields than Table B
from B, A
where B.F1 != A.F1 and B.F2 != A.F2 and B.F3 != A.F3
The error message was that the SELECT query is too big and I have to check the WHERE clause.
MAX_JOIN_SIZE on my database is already 1000000 and I want to avoid SET SQL_BIG_SELECTS=1.
Does anyone know a better WHERE clause than mine? or should I do SET SQL_BIG_SELECTS=1?
Any hint will help! THANKS!
Andre
The following is always a problem to me. I've asked about this before, but so far have no luck.
MySQL Version is 4.1.13.
I have two tables, let's say A and B. Table A has 150K records, Table B has 300K.
Both have unique index on field F1, F2, F3 (these fields are in both tables).
What I want to do is:
I want to insert records from Table B into Table A, only the records that are not yet in Table A
(so it could be all records in Table B).
I wrote:
insert into A
select B.*,
'','','' #Table A has more fields than Table B
from B, A
where B.F1 != A.F1 and B.F2 != A.F2 and B.F3 != A.F3
The error message was that the SELECT query is too big and I have to check the WHERE clause.
MAX_JOIN_SIZE on my database is already 1000000 and I want to avoid SET SQL_BIG_SELECTS=1.
Does anyone know a better WHERE clause than mine? or should I do SET SQL_BIG_SELECTS=1?
Any hint will help! THANKS!
Andre