J
Joe Mac
All...
I'm new to Access and SQL... I ran a core "Duplicates" query and captured
the SQL as well as a simple update query and captured the SQL as well... I
attempted to combine the SQL from both to create a new Update query to
calculate the number of Policies in the datbase unique for each Policy Number
and then update each policy record with that count... attached is the
composite SQL...
Example of what I'd like to do: There are 2 records in the database under
the Policy number of 123; I'd like to have each record updated in the
Policy_Count filed to read 2...
Policy Policy_Count
123 2
123 2
UPDATE [Policy Numbers] SET [Policy Numbers].POLICY_COUNT = (SELECT
First([Policy Numbers].CLIENT_ASGN_CUST_ID) AS [CLIENT_ASGN_CUST_ID Field],
Count([Policy Numbers].CLIENT_ASGN_CUST_ID) AS NumberOfDups
FROM [Policy Numbers]
GROUP BY [Policy Numbers].CLIENT_ASGN_CUST_ID
HAVING (((Count([Policy Numbers].CLIENT_ASGN_CUST_ID))>1)));
I hope this makes sense -
I'm new to Access and SQL... I ran a core "Duplicates" query and captured
the SQL as well as a simple update query and captured the SQL as well... I
attempted to combine the SQL from both to create a new Update query to
calculate the number of Policies in the datbase unique for each Policy Number
and then update each policy record with that count... attached is the
composite SQL...
Example of what I'd like to do: There are 2 records in the database under
the Policy number of 123; I'd like to have each record updated in the
Policy_Count filed to read 2...
Policy Policy_Count
123 2
123 2
UPDATE [Policy Numbers] SET [Policy Numbers].POLICY_COUNT = (SELECT
First([Policy Numbers].CLIENT_ASGN_CUST_ID) AS [CLIENT_ASGN_CUST_ID Field],
Count([Policy Numbers].CLIENT_ASGN_CUST_ID) AS NumberOfDups
FROM [Policy Numbers]
GROUP BY [Policy Numbers].CLIENT_ASGN_CUST_ID
HAVING (((Count([Policy Numbers].CLIENT_ASGN_CUST_ID))>1)));
I hope this makes sense -