I have a table of about 1.6M rows where the records have a unique (identity) ID and then also have a 8-character "code" field. The code field it used to group data into sets...all rows with the same code are in the same set. Each set should consist of 12 records, but it seems our data load was off and some sets are incomplete.
I need to identify the incomplete sets. How would I write a query to select out only those records that are part of a set that do NOT have the proper number of records in their set (12)?
I am using MS SQL 2008.
Thanks.