SELECT
xfqti_virtuemart_products_pt_pt.virtuemart_product_id,
xfqti_virtuemart_product_medias.virtuemart_media_id
INTO #tempTable
FROM xfqti_virtuemart_products_pt_pt
,帶出語法錯誤,我就要拉我的頭髮掉SELECT INTO錯誤
SELECT
xfqti_virtuemart_products_pt_pt.virtuemart_product_id,
xfqti_virtuemart_product_medias.virtuemart_media_id
INTO #tempTable
FROM xfqti_virtuemart_products_pt_pt
,帶出語法錯誤,我就要拉我的頭髮掉SELECT INTO錯誤
插入進和Selecthave這些sintax
Insert into your_Table (col1,col2)
SELECT
xfqti_virtuemart_products_pt_pt.virtuemart_product_id,
xfqti_virtuemart_product_medias.virtuemart_media_id
FROM xfqti_virtuemart_products_pt_pt
用於創建表
Create your_Table as
SELECT
xfqti_virtuemart_products_pt_pt.virtuemart_product_id,
xfqti_virtuemart_product_medias.virtuemart_media_id
FROM xfqti_virtuemart_products_pt_pt
「your_table」不存在 - 錯誤1146 –
@BrunoTeixeira你必須用適當的代碼更改單詞「your_table」 ......我不知道your_table – scaisEdge
名字的問題是我想用選擇創建表格,我不想使用已經存在的表格 –
被Virtuemart,我猜這是一個MySQL數據庫。如果是這樣,創建臨時表正確的語法是:
CREATE TEMPORARY TABLE IF NOT EXISTS tempTableName AS
(
SELECT field1, field2
FROM yourtable;
)
話雖這麼說,你的SELECT
語句有兩個不同表中兩個字段,但只有其中一個表中提到的從你的語句的WHERE子句。他們應該真的都在那裏並加入。喜歡的東西:
CREATE TEMPORARY TABLE IF NOT EXISTS tempTableName AS
(
SELECT
t1.virtuemart_product_id,
t2.virtuemart_media_id
FROM
xfqti_virtuemart_products_pt_pt as t1
INNER JOIN xfqti_virtuemart_product_medias as t2 ON
t1.product_id = t2.product_id
)
或者東西..我看不到你的表,它已經,因爲我用Virtuemart年,所以它只是在餐桌關係的猜測。
我很確定數據庫引擎不只是給你「sintax錯誤」。什麼是你收到的實際錯誤信息?你在使用什麼數據庫系統? –
這個'xfqti_virtuemart_product_medias'從哪裏來? –
錯誤1064附近,距 –