I try to delete a row from my table, but when I try I get an error : #1241 - Operand should contain 1 column(s)
My query is : DELETE FROM Posts WHERE idPosts = 6;
I don’t understand why I can’t delete the post (the post with idPosts = 6 exists)
I have a trigger on the table too :
CREATE TRIGGER post_delete_update_lastPost_topic after delete on Posts for each row
BEGIN
UPDATE Topics SET lastPost = (SELECT *
FROM Posts
WHERE idTopic = old.idTopic
ORDER BY datePosts DESC
LIMIT 1)
WHERE idTopics = old.idTopic;
END $$
In your trigger you are doing a
SELECT *whereas you should just select the column corresponding to lastPost. I suppose this is something likeSELECT postId