473,549 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updating single record within a bunch of duplicates

1 New Member
Hi I'm a newbie here. I'm hoping someone can help me..

Here is the scenario:
I have a bunch of duplicate records I need to clean up
This query below will help me identify the list of duplicate records.

select * from Tablename
where acctdebitid like '57%' and status = 'WILLPROCESSON'
and datecreate like '2006/01/13%'
order by customerid, id, listid, date

All the columns are dups with the exception of one obvious one which is the primary key.

I would like to be able to iterate through this entire list and identify the first row in a set of duplicate records and do an update. Is this possible in SQL ?

Thanks in advance!
Mar 29 '06 #1
1 1405
CaptainD
135 New Member
What kind of update?

I've not tried it but off my head I would look into an Update with a "where Not IN (Select top 1 with a count >1 and a group by cluase)" type statement.

Sorry, I'm not at my work computer with a server to do a test on.

Hope it points you in a right direction...



Hi I'm a newbie here. I'm hoping someone can help me..

Here is the scenario:
I have a bunch of duplicate records I need to clean up
This query below will help me identify the list of duplicate records.

select * from Tablename
where acctdebitid like '57%' and status = 'WILLPROCESSON'
and datecreate like '2006/01/13%'
order by customerid, id, listid, date

All the columns are dups with the exception of one obvious one which is the primary key.

I would like to be able to iterate through this entire list and identify the first row in a set of duplicate records and do an update. Is this possible in SQL ?

Thanks in advance!
Mar 30 '06 #2

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

Similar topics

11
16104
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? 1) simply UPDATING the values for all fields in the table, whether or not any particular field has actually changed 2) running a second SELECT...
5
1485
by: rong.guo | last post by:
I would need to create multiple variables with the same format for future update, what I did is listing them separately, is there an easy way to combine them in one step? please see query below. Thanks a lot! --Current Query-- SELECT cast(0.0 as money) as balance_1 ,cast(0.0 as money) as balance_2 ,cast(0.0 as money) as balance_3...
7
2284
by: Foxster | last post by:
in access i have two tables (tblplayer, tblpoints) in tblplayer i have field totalpoint (number) in tlbpoints i have field pointgame (number) the two files are related via idplayer now i made a query "qrybegan" and in that query i calculate a field sumpointgame which is the sum of all the field pointgame (option sum in the query) i have...
6
1376
by: Abdolhosein Vakilzadeh Ebrahimi | last post by:
hi: I've a series of records, say 1000, have a counter field which is indexed+no duplicates. I want to set counter to (counter+1), when I execute this query, it takes error because of duplicate values, what should I do? UPDATE Table1 SET id=id+1; thanks n regards
6
2382
by: Marlene | last post by:
Hi All I have the following scenario, where I have found all the duplicates in a table, based on an order number and a part number (item).I might have something like this: Order PODate Rec Qty Invoice# Item Supplier Status POReceivedDate 570133 03/09/2004 50 0 DMEDIUM L0010 PENDING 03/09/2004...
2
2377
by: Ray Holtz | last post by:
I have a form that shows a single record based on a query criteria. When I click a button it is set to use an append query to copy that record to a separate table, then deletes the record from the first table. Both tables have a 'DateTime' field that shows when it was last updated using the Now function. What I am trying to do is get the...
5
3316
by: Ross A. Finlayson | last post by:
Hi, I'm scratching together an Access database. The development box is Office 95, the deployment box Office 2003. So anyways I am griping about forms and global variables. Say for example I'm adding a customer. The Customer fields are mostly foreign keys that refer to primary keys in other tables, left join instead of junction tables...
5
3288
by: Lyn | last post by:
This one is difficult to explain, so I will cut it down to the basics. I have a major table 'tblA' which has an autonum field 'ID-A' as primary key (of no significance to users). 'tblA' contains many fields including picture and memo fields. The main user-selectable field is 'NameA'. There is also a crossreference table (let's call it...
33
3263
by: bill | last post by:
In an application I am writing the user can define a series of steps to be followed. I save them in a sql database using the field "order" (a smallint) as the primary key. (there are in the range of 20 steps) On the admin page the steps are listed, in "order" order and the user can create new steps and assign an order and all is well. ...
0
7450
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7470
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7809
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6043
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3500
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1941
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 we have to send another system
0
763
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.