in reply to Using Perl to update multiple Database Records but not all
Then the contents of the first csv file would be entered with statements like the following:CREATE TABLE txn (txn_id INT PRIMARY KEY AUTO_INCREMENT, account VARCH +AR(64), amount INT); ALTER TABLE txn ADD INDEX i1 (account);
and the contents of the second csv file would be entered as:INSERT INTO txn VALUES (NULL, '101', 40167); INSERT INTO txn VALUES (NULL, '101', 30821); ...
To determine which accounts are not reconciled, perform the following query:INSERT INTO txn VALUES (NULL, '101', -131386);
and this will list the accounts and the amounts by which they are off.SELECT account, SUM(amount) as total FROM txn GROUP BY account HAVING +total <> 0;
|
|---|