473,480 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Identifying non-duplicate records

1 New Member
I have a table containing a 'data' field and a 'status' field. I want to set the 'status' value to 1 for each record that has exactly one occurrence of 'data' in the table. I.e. if the value of 'data' occurs in multiple records, then do not update the 'status' field.

Is there some way to do this with SQL alone? I wrote some VBA code to step through the recordset of items having count(*) = 1 and executing a RunSQL within the loop to update 'status', but this runs extremely slowly...

Suggestions?

Thanks!
Kevin
Oct 11 '07 #1
1 1292
nico5038
3,080 Recognized Expert Specialist
For a fast processing you would need a "query only" solution, but without an additional unique ID (e.g. an autonumber), you can only use a Dcount() function that will also slowdown processing :-(
With an autonumber you can create a groupby query counting the occurrences and determing the Minimum ID.
That query can be used to update the table with the Status = 1 when the record's ID Exists in that groupby query.

When only "single" records are needed, then limit the Groupby query to return only data for the Count(*) = 1.

Getting the idea ?

Nic;o)
Oct 11 '07 #2

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

Similar topics

1
6133
by: David | last post by:
I know that identifying the user IP address with HTTP_SERVER_VARS; is reliant on the browser agent but I have stumpled upon the following code which I have tried to understand but failed! ...
3
848
by: hokiegal99 | last post by:
This is not really a Python-centric question, however, I am using Python to solve this problem (as of now) so I thought it appropiate to pose the question here. I have some functions that search...
21
2195
by: dkcpub | last post by:
I'm very new to Python, but I couldn't find anything in the docs or faq about this. And I fished around in the IDLE menus but didn't see anything. Is there a tool that can determine all the...
0
1530
by: Joshua Beall | last post by:
Hi All, I've been taking a look at DB Designer 4, and looking through the documentation (http://www.fabforce.net/dbdesigner4/doc/index.html) I am a little unclear on some of their nomenclature:...
18
1402
by: Jeff S | last post by:
It seems that anyone can put anything on their resume and refer to themselves as a "senior Web developer." What are some clues that can be used by an IT manager during a hiring process to...
9
2643
by: kw | last post by:
What is the proper way to get the element ID for a client script? For example, suppose in the WebControl: TextBox t=new TextBox; t.ID=this.ClientID+"X"; .... Then elsewhere we want to access...
4
1698
by: Ed L. | last post by:
I am trying to identify tables with significant diskspace "leakage" due to in appropriately low max_fsm_pages settings. I can see the results of VACUUM ANALYZE VERBOSE output counts of tuples and...
2
1706
by: jim_geissman | last post by:
Some columns in transaction tables are "mandatory fields" on the data entry screens, and as a result tend to accumulate junk entries, where the user puts something, anything, in the window in order...
10
4474
by: Frankie | last post by:
It appears that System.Random would provide an acceptable means through which to generate a unique value used to identify multiple/concurrent asynchronous tasks. The usage of the value under...
23
1238
by: tkpmep | last post by:
I have a list that starts with zeros, has sporadic data, and then has good data. I define the point at which the data turns good to be the first index with a non-zero entry that is followed by at...
0
7041
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
7043
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
6921
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5336
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
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2984
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
179
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.