尝试将表与SQL链接
问题描述:
I'm trying to link two tables on phpMYadmin using sql so that the "cuisineid" is the same on both tables
at the moment this is the code im using at the moment
INSERT INTO`recipename`
SELECT`Nation`.cuisineid
FROM`Nation`
INNER JOIN`recipename`
ON`Nation`.cuisineid=`recipename`.cuisineid
this is the error i'm getting..
#1136 - Column count doesn't match value count at row 1
我正在尝试使用sql链接phpMYadmin上的两个表,以便两个表上的“cuisineid”相同 p>
目前这是我正在使用的代码 p>
INSERT INTO`recipename`
SELECT`Nation`.cuisineid \ nFROM`Nation`
INNER JOIN`recipename`
ON`Nation`.cuisineid =`recipename`.cuisineid
code> pre>
这是我得到的错误.. p>
#1136 - 列数与第1行的值计数不匹配 p>
div>
答
Your table recipename
must have more than one column.
Either you intended to select more columns to insert; for example if recipename
has 4 columns:
INSERT INTO `recipename`
SELECT `Nation`.cuisineid, someColumn, 'foo', someOtherColumn, 'bar'
FROM `Nation`
INNER JOIN `recipename`
ON `Nation`.cuisineid = `recipename`.cuisineid
Or perhaps you meant to specify a column list, telling which column the data is for (other columns will get their default value):
INSERT INTO `recipename` (cuisineid)
SELECT `Nation`.cuisineid
FROM `Nation`
INNER JOIN `recipename`
ON `Nation`.cuisineid = `recipename`.cuisineid