You get a bonus - 1 coin for daily activity. Now you have 1 coin

Delete a parent post and all its child comments in a single MySQL query

Practice




Delete a parent post and all its (child) comments with a single MySql query

there is a table

id test autorid parentid ojectid



parentid=0 if it's a post, otherwise it's a comment on a post
very simple

DELETE FROM postAndCommentTible WHERE parentid= ? OR id =?

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Databases - MySql (Maria DB)"

Terms: Databases - MySql (Maria DB)