Working with COU data
Last updated
Was this helpful?
Was this helpful?
SELECT uprn, COUNT(uprn) AS NumOccurrences FROM addressbase_plus
GROUP BY uprn
HAVING ( COUNT(uprn) > 1 );DELETE FROM addressbaseplus WHERE uprn IN (SELECT uprn FROM addressbaseplus_cou WHERE change_type != 'I');INSERT INTO addressbaseplus SELECT * FROM addressbaseplus _cou WHERE change_type != 'D';CREATE TABLE addressbaseplus_archive AS SELECT * FROM addressbaseplus
WHERE uprn IN (SELECT uprn FROM addressbaseplus_cou WHERE change_type != 'I');DELETE FROM addressbaseplus
WHERE uprn IN (SELECT uprn FROM addressbaseplus_cou WHERE change_type!= 'I');INSERT INTO addressbaseplus SELECT * FROM addressbaseplus_cou WHERE change_type != 'D';