When I execute this query, I get this error message "Error code: 1172. The result contains more than one row"
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
id is the primary key of the table below?
P粉3223196012024-04-05 13:11:10
Your local variable has the same name as the table column. This way you never compare the local variable to the column, but always to the local variable itself.
Your query needs to return exactly one row to provide the id variable
1 2 3 |
|
user_been_following_id and user_following_id are interpreted as local variables in all instances and are therefore translated as follows
1 2 3 |
|
Returns all rows of user_following. To fix this, rename your local variables like
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
(Assuming there is no column named local_user_been_following_id or local_user_following_id on table user_following)
See also here: https://dev.mysql.com/doc/ refman/8.0/en/local-variable-scope.html