Some content is processed using an SQL statement. MySQL reported error when executing a statement: Operand should contain 1 column
Literally, you need to have 1 columns of data.
My SQL statement is similar to this:
Update cdtable set cdcontent= ' CD is a good boy ' where ID in (
SELECT * FROM (
SELECT * from cdtable where cdtype into (1,2,3) Order BY id DESC LIMIT 100
) as CD
)
While the literal meaning of the error is missing the column, where is the column missing?
Tested and found to be wrong after adding the outermost SQL statement
After a careful look at the statement, found in the blue section of the above statement "where ID in (~ ~ ~)", the subquery used (SELECT * ~ ~) subquery to get more than one column of data records
And obviously, the condition data that the where ID in needs is a column, and that's where the problem occurs.
The solution is to change the "*" to "id" of the first-level subquery in the Where ID in (~ ~) brackets, and the sentence after the change is like:
Update cdtable set cdcontent= ' CD is a good boy ' where ID in (
Select ID from (
SELECT * from cdtable where cdtype into (1,2,3) Order BY id DESC LIMIT 100
) as CD
)