mysql - Delete statement in a same table -
I need to query a statement statement for a single table based on column positions from the same table for a reflected subquery is.
I can not run a delivery statement directly and can check a condition for the same table in mysql for a correlated subquery.
I know that using the temp table will affect the memory / performance of mysql
Thanks.
Any help would be appreciated.
Your question is not really clear, but I think you have a correlated subkey and you have been locked by DELETE from the same table, which is SELECT one. For example, everyone has to delete the most recent revision of a document:
Remove from document_re revisions d1 WHERE edit_date & lt; (Document MAX_revisions d2 WHERE d2.document_id = d1.document_id to maximum MAX (edit_date));
This is a problem for MySQL.
Many examples of these types of problems can be solved by using MySQL multi-table removal syntax:
Remove <1> from document_reventions D1 Joint Document_Review D2 On d1.document_id = d2.document_id and d1.edit_date & lt; D2.edit_date;
But these solutions are best designed on a case-by-case basis, so if you edit your question and are trying to solve the problem, So maybe we can help you
In other cases you may be right, using the temporary table is the simplest solution.
Comments
Post a Comment