This is my SQL query:
DELETE gur FROM group_master gm JOIN group_users gu ON gu.group_id=gm.id JOIN group_user_roles gur ON gur.group_user_id=gu.id WHERE gm.school_code = 14741359 AND gm.ayid=3 LIMIT 1;
I get an error saying there is a syntax error near LIMIT. I found a solution here: DELETE using LEFT JOIN with LIMIT in MySQL. I can't convert the query into a select statement.
Only single tableDELETE supports LIMIT.
Use the query as a SELECT with LIMIT and get the ID of the row (remember - LIMIT without ORDER BY is a lottery). Then delete the corresponding rows from the other copy of the table.
Replace
id
with the primary key or unique column/expression of thegroup_user_roles
table.