THE PROBLEM ----------- journal caisee ntikora kubera hariho ama data muri api_balancegeneral ari duplicated gut?? -> plan_comptable_id na date birasa kurizo data kubera iki izo data ziri duplicated?? ?? ubwo hoba hari habaye iki from 33228 115619 113058 WITH ordered AS ( SELECT rowid, ROW_NUMBER() OVER (ORDER BY rowid) + 33228 AS new_id FROM api_historique ) UPDATE api_historique SET id = (SELECT new_id FROM ordered WHERE ordered.rowid = api_historique.rowid); ################ delete duplicata but keep one and keep not duplicatated data ################ DELETE FROM api_historique WHERE rowid NOT IN ( SELECT MIN(rowid) FROM api_historique GROUP BY line, balance_compte_avant, balance_compte_apres, date, details, compte_id, user_id ); ############# 1011 2025-04-15 SELECT plan_comptable_id, date FROM api_balancegeneral GROUP BY plan_comptable_id, date HAVING COUNT(*) > 1; ###### delete duplicated data in balance general where credit=0 and debit=0 DELETE FROM api_balancegeneral WHERE (plan_comptable_id, date) IN ( SELECT plan_comptable_id, date FROM api_balancegeneral GROUP BY plan_comptable_id, date HAVING COUNT(*) > 1 ) AND credit = 0 AND debit = 0;