How do I look at a previous record in access for duplicates?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a situation where I have an identification number for each site. But
sites that are grouped together with one supervisor share the first 6 numbers
in the identification. I would like to go through my list and weed out the
duplicates that are under one supervisor and only take the record that ends
in "000". The sites that are not sharing a supervisor do not necessarily end
in "000", so I must look at the first 6 numbers to see if they are the same
as the previous record. How do I do that?
 
What is the full structure of the site number? Is the structure consistent in
length? The following may give you a start on what you want.

SELECT MIN(SiteID) as UniqueSiteNumber
FROM SiteIDTable
GROUP BY Left(SiteID,6)

You could use that as a subquery tgo give you more infor.

SELECT SiteIDTable.*
FROM SiteIDTable
WHERE SiteIDTable.SiteID IN
(SELECT MIN(SiteID) as UniqueSiteNumber
FROM SiteIDTable
GROUP BY Left(SiteID,6))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top