Duplicate entry error but dupes are there
I am getting an error when inserting into a temp table that's created thusly
CREATE TEMPORARY TABLE IF NOT EXISTS stage_package_dim (
`account_key` BIGINT(20) NOT NULL,
`processdate_est_key` INT(11) NOT NULL,
`package_id` INT(11) NOT NULL,
`package_name` VARCHAR(255) NULL DEFAULT NULL,
`package_description` VARCHAR(255) NULL DEFAULT NULL,
`package_type` VARCHAR(255) NULL DEFAULT NULL,
`package_order` INT(11) NULL DEFAULT '1',
`package_cost` DECIMAL(16,4) NULL DEFAULT '0.0000',
`package_credits` DECIMAL(16,4) NULL DEFAULT '0.0000',
PRIMARY KEY (`account_key`, `processdate_est_key`, `package_id`),
INDEX `package_type` (`package_type`)
);
The error reads
Duplicate entry '1000000000000000001-1368576000-6001' for key 'PRIMARY'
So I tried to find the dupes for my composite key but I don't think my query is correct
SELECT
account_key,COUNT(distinct processdate_est_key,package_id)
FROM staging_package_dim
GROUP BY account_key
HAVING COUNT(account_key) >1 order by 1 limit 10
but it's giving me the following result
+---------------------+--------------------+
| account_key | COUNT(account_key) |
+---------------------+--------------------+
| 1000000000000001001 | 1473 |
| 1000000000000002001 | 623 |
| 1000000000000003001 | 745 |
The composite key should not allow dupes, correct? How do I get the unique values for my primary key? Am I missing something here?