I'm trying to delete the user from the application, but first I need to delete all the records associated with it from the Chat table. (i.e., to delete a user, I need to delete all messages from the tasks in which it is involved -> Delete all tasks in which it participates -> Delete it from all projects -> And finally delete it from the USERS table).
I make the following query:
select c. *, pt.user_id, pt.project_id from chat c left join projects_tasks pt on c.task_id= pt.id where pt.user_id= 27
He shows me the data that I want to remove from the Chat table.
Now, I want to delete recordings from Chat on the resulting ID
Delete from Chat Where ID In (Select C. *, Pt.user_id, Pt.Project_ID from Chat C Left Join Projects_Tasks PT on C.Task_id= Pt.id WHERE PT.USER_ID= 27)
But an error is issued:
How can I solve this problem?
my database structure:
- php : How to fix the bug in the request
- php : How to get the data from the MYSQL database tables?
- php : How to organize relations between tables and data storage in this case?
- php : Get a user in the ranking
- php : Reserved words as a column name
- php : How to implement a shift /update not all data, but only those introduced an authorized user
- php : How do I make a check on the fact that the account is in the table, and if so how can I find out his password?
- php : Is it possible to execute SQL request under the condition
- mysql : SQL for some reason changes the date
- php : Personal conclusion from request