Changes

Jump to navigation Jump to search
802 bytes added ,  17:30, 18 July 2017
FROM (SELECT DISTINCT targetname, targetstatecode, announceddate FROM mas)a;
--114825
Great! The counts don't match so we'll have to clean the mas table. There is no obvious field to filter against with mas. So I inserted an id column in mas and took the MIN id for duplicate keys. CREATE TABLE mas1 AS SELECT * FROM mas; ALTER TABLE mas1 ADD COLUMN id SERIAL PRIMARY KEY; ALTER TABLE mas ADD COLUMN id SERIAL PRIMARY KEY;  DROP TABLE masinclude; CREATE TABLE masinclude AS SELECT targetname, targetstatecode, announceddate, MIN(id) as id FROM mas1 GROUP BY targetname, targetstatecode, announceddate; --114825  DROP TABLE mascore; CREATE TABLE mascore AS SELECT mas.* FROM mas INNER JOIN masinclude ON mas.id = masinclude.id; --114825  SELECT COUNT(*) FROM (SELECT DISTINCT targetname, targetstatecode, announceddate FROM mascore)a;The mas distinct key count match the total count of the table so therefore the mascore table is clean.
==Creating Stage Flags Table==

Navigation menu