Fascinating - I've never seen the minus keyword for SQL yet. Up to day, I've always used left outer joins to find out the missing parts between two sets of keys:
-- in table2 but not in table1: SELECT r.id FROM table2 AS r LEFT JOIN table1 AS l ON r.id = l.id WHERE r.system = ? and l.id IS NULL and r.id IS NOT NULL -- in table1 but not in table2: SELECT l.id FROM table2 AS l LEFT JOIN table1 AS r ON l.id = r.id WHERE l.system = ? and l.id IS NOT NULL and r.id IS NULL SQL
SQLite doesn't seem to document the minus keyword, so I'll stay with my (left) outer join solution, as SQLite doesn't support the full outer join. Of course, I haven't checked whether DBD::CSV supports outer joins, and I guess it doesn't jZed tells me it does, so these two SQL statements will be put to more and more use. How convenient if your whole business logic can be expressed in two SQL statements.
In reply to Re^3: Comparing CSV files
by Corion
in thread Comparing CSV files
by benz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |