473,405 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Still still have duplicates when running the Distinct in Access

6
I only want the unique values (unique on rcnumber) in my table but keep getting duplicates. Any solutions other than DISTRICT ??
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT OFFice.Rcnumber, OFFice.[SAP number], OFFice.Outlet, OFFice.Business, OFFice.BusinessType, OFFice.Address, OFFice.City, OFFice.Prov, OFFice.Pcode, OFFice.PCode_FlexDeliv, OFFice.Phone, OFFice.Contact, OFFice.[Old RC], OFFice.FSA, OFFice.Node, OFFice.Open, OFFice.Close, OFFice.Renewal, OFFice.ContractYear, OFFice.Expiry, OFFice.Extension, OFFice.Division, OFFice.Division_Fr, OFFice.[Lang Pref], OFFice.[Lang Cap], OFFice.[Lang Off], OFFice.Type, OFFice.[Type Desc], OFFice.[Type Desc French], OFFice.PSC_Indicator, OFFice.[Contract Type], OFFice.[Current Image], OFFice.Code2, OFFice.CORP_PRIV, OFFice.CPCUnion, OFFice.[National Acct], OFFice.[Parent RC], OFFice.[Parent Title], OFFice.Manager, OFFice.[Parent Sname], OFFice.[Parent Fname], OFFice.[Supt CC], OFFice.[Supt Title], OFFice.SuptName, OFFice.[Parent2 RC], OFFice.Director_CostCentre, OFFice.[Parent2 Title], OFFice.Director, OFFice.[Parent2 Sname], OFFice.[Parent2 Fname], OFFice.[Parent3 RC], OFFice.GM_CostCentre, OFFice.[Parent3 Title], OFFice.GM, OFFice.[Parent3 Sname], OFFice.[Parent3 Fname], OFFice.[Rev Level], OFFice.Rev2015, OFFice.Rev2014, OFFice.Rev2013, OFFice.Rev2012, OFFice.Rev2011, OFFice.Rev2010, OFFice.Rev2009, OFFice.Rev2008, OFFice.Rev2007, OFFice.Rev2006, OFFice.Rev2005, OFFice.Rev2004, OFFice.Rev2003, OFFice.Rev2002, OFFice.Rev2001, OFFice.AVG_YEARS, OFFice.[Weekly Hours], OFFice.[Hours Issues], OFFice.[Hours Desc], OFFice.[Hours Desc_Fr], OFFice.[Hours NumDays], OFFice.DTPOTonight, OFFice.InfoBoard, OFFice.InfoBoardPosterUpdated, OFFice.AVG_RG, OFFice.Urb_Rur, OFFice.[Op Fee], OFFice.[Rev Sub], OFFice.[Serv Sub], OFFice.[Dealer PrMode Boxes], OFFice.TaxClass, OFFice.[Co-Located], OFFice.CGRP, OFFice.CGRP_E, OFFice.CGRP_F, OFFice.RPS_Transition, OFFice.RPS_Transition_F, OFFice.[RPS Indicator], OFFice.RPS, OFFice.hasCARO, OFFice.[RPS Connection Type], OFFice.[RPS 12 M Avg], OFFice.[RPS Curr M Avg], OFFice.[RPS Last 12 Sales], OFFice.[RPS Nbr Months], OFFice.RPS_SAP, OFFice.PAD, OFFice.PAD_Freq, OFFice.PAP, OFFice.[Caro Avg], OFFice.[Caro Days], OFFice.PostMasterProvided, OFFice.Lease_expiry, OFFice.Latitude, OFFice.Longitude, OFFice.lambert_x, OFFice.lambert_y, OFFice.Market_Type, OFFice.Market_Area, OFFice.Market, OFFice.FED_Name, OFFice.FED_Name_Fr, OFFice.FEDMP, OFFice.FED_Party, OFFice.FED_Party_Fr, OFFice.CUSTOMER_S, OFFice.RevGroupNa, OFFice.Cut_Off_Time, OFFice.Cut_Off_Time_World, OFFice.TotalCallFor, OFFice.AvgDailyCallFor, OFFice.CallForEndDate, OFFice.CallForStartDate, OFFice.AvailableToNetwork, OFFice.RC_NO
  2. FROM OFFice;
Jan 13 '17 #1

✓ answered by PhilOfWalton

I am guessing that there are about 90 fields specified in your query.
for the DISTINCT to give a single value, ALL 90 fields must be the same.

If you only want RCNumver your SQL should be:-

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT Rcnumber FROM OFFice;
  2.  
I would add that a table with that many fields is almost certainly wrong and the database has not been normalised. It looks like an Excel sheet. Seeing a years from 2001 to 2015 indicates that the table STRUCTURE needs changing each year. Very Bad!!!.

There seem to be a number of references to a Parent. I'm guessing this should be in another table. There are references to people's names. Another table.

There are lots of articles about normalisation.May I suggest you read these and review your DB. Without that, you will not get the benefit of a relational database.

If you see repeated TEXT information on different records in a table it almost certainly is wrong.

A very broad guide is each independent entity should have it'sown table. So the Office, its address & contact numbers and things that are intrinsically a part of that Office in 1 table.

People:- Names, titles, job description, dates of birth sex etc exist in their own right, so another table.

Phil

1 667
PhilOfWalton
1,430 Expert 1GB
I am guessing that there are about 90 fields specified in your query.
for the DISTINCT to give a single value, ALL 90 fields must be the same.

If you only want RCNumver your SQL should be:-

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT Rcnumber FROM OFFice;
  2.  
I would add that a table with that many fields is almost certainly wrong and the database has not been normalised. It looks like an Excel sheet. Seeing a years from 2001 to 2015 indicates that the table STRUCTURE needs changing each year. Very Bad!!!.

There seem to be a number of references to a Parent. I'm guessing this should be in another table. There are references to people's names. Another table.

There are lots of articles about normalisation.May I suggest you read these and review your DB. Without that, you will not get the benefit of a relational database.

If you see repeated TEXT information on different records in a table it almost certainly is wrong.

A very broad guide is each independent entity should have it'sown table. So the Office, its address & contact numbers and things that are intrinsically a part of that Office in 1 table.

People:- Names, titles, job description, dates of birth sex etc exist in their own right, so another table.

Phil
Jan 13 '17 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Adam Barnett via AccessMonster.com | last post by:
I have an Access application split into a FE and BE with a workgroup file (.mdw) for authentication. I currently have the FE application setup as a published application for 40 users. We have been...
2
by: Oenone | last post by:
I am developing an assembly that can be used either by a Windows Forms application or from within an ASP.NET web site. When running within the Forms app, I can break into the code while it is...
1
by: utpal | last post by:
Hi, My CSharp program, when I run from the local drive it can create/modify registry. However running the program from a network drive, gives RegistryPremission error. I don't belive that just by...
8
by: Shooter4Life8 | last post by:
I am trying to run a macro from my VB.NET program. Here is my code. Dim myAccess As Access.Application Dim allMacro As String = "ALL-Macros" myAccess.DoCmd.RunMacro(allMacro) I get the error....
5
bhcob1
by: bhcob1 | last post by:
Hi guys, I have access 2000, I have a form frmCSOC, with a field that can have duplicates, I want a label to display how many records there are with DISTINCT values. I have heard that the...
5
by: =?Utf-8?B?cnZhbmdlbGRyb3A=?= | last post by:
Hello, I have a problem with our OnlineBackupService.exe. This is a Windows Service which is built in .Net 1.1 and basically grabs files from the file system and will try to upload them using...
1
by: Wayne | last post by:
I've found a painful bug when running an Access 2003 database under Access 2007. It manifests in both XP and Vista. Some combo boxes on some forms become transparent when they lose focus. It...
2
by: ncsthbell | last post by:
I am running MS Access 2007. If I have an access application running on a network can I control the read/write access for the data by setting the form properties to yes or no for "Allow Additions",...
4
by: Paul Howarth | last post by:
I posted this question.... http://bytes.com/topic/access/answers/946707-crosstab-queries-responsible-access-error-msg ...and was provided with the following support link which completely...
1
anoble1
by: anoble1 | last post by:
Hi, In Access, I am getting error: excel object variable or with block variable when running code. The code runs fine the first time when I start it. When I close excel and hit the button again it...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.