Last active
January 29, 2018 15:19
-
-
Save mattm/f9539fa26472bb2fc024002466092084 to your computer and use it in GitHub Desktop.
Deleted Payment Records 2017+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SET @mpy_id = (SELECT MAX(mpy_id) + 1 from members_payments); | |
| DROP TABLE IF EXISTS members_payments_all_ids; | |
| CREATE TEMPORARY TABLE members_payments_all_ids AS ( | |
| SELECT @mpy_id := @mpy_id - 1 AS mpy_id | |
| FROM members_payments mp1, members_payments mp2 | |
| WHERE @mpy_id > 1 | |
| ); | |
| SELECT members_payments_all_ids.mpy_id AS mpy_ids | |
| FROM members_payments_all_ids | |
| LEFT JOIN members_payments ON members_payments_all_ids.mpy_id = members_payments.mpy_id | |
| WHERE | |
| members_payments.mpy_id IS NULL AND | |
| members_payments_all_ids.mpy_id >= 162396 | |
| ORDER BY members_payments_all_ids.mpy_id ASC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment