tianxuedong@stripped wrote:
>
> Chris:
>
> Thanks a lot. I will break my table into two.
> I am looking for the command to select columns from
> different database tables into another database table.
> However, I could not find one. The way I am doing is
> use "select .. into outfile..." and then "create.."
> and "load data infile..". However, This step takes about
> 5 days!! My final table will be 9200 records and 2500
> columns(as I said, but I will break it into two).
> I guess there must be more efficient way to do it which I
> donot know
Try something like this:
INSERT INTO
databaseB.thirdTable
(fieldA, fieldB, fieldC, fieldD)
SELECT
a.fieldOne
, a.fieldTwo
, b.field1
, b.field2
FROM
databaseA.firstTable AS a
JOIN databaseA.secondTable AS b
WHERE
a.ID = b.ID
;
If this takes a very long time, you should use "LIMIT start, amount" to only copy a little
portion of the whole data at a time, and let other queries run in between the portions.
Tschau
Christian