1

おそらくこれはばかげていますが、product_ID がプライマリで一意である 2 つの既存のテーブルを結合して、データベースに新しいテーブルを作成しようとしています。

私はこれを試しましたが、うまくいきませんでした

CREATE TABLE new_table_name
SELECT *
FROM table1 t1, table2 t2, WHERE t1.product_id = t2.product_id;

CREATE TABLE new_table_name
SELECT *
FROM table1 AS t1, table2 AS t2, WHERE t1.product_id = t2.product_id;
4

3 に答える 3

3

構文が間違っていると思います。これを試してみてください

CREATE TABLE new_table
AS (SELECT * FROM old_table);


CREATE TABLE NEW_TABLE
AS
  (SELECT *
FROM table1 AS t1, table2 AS t2, WHERE t1.product_id = t2.product_id);
于 2013-10-29T11:38:29.257 に答える
0

CREATE TABLE ... SELECT 構文を使用します。

これを参照してくださいhttp://dev.mysql.com/doc/refman/5.0/en/create-table-select.html

于 2013-10-29T11:34:02.007 に答える