×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Dynamic delete

Dynamic delete

Dynamic delete

(OP)
Given tblA
Xid int, id int, create_date datetime, foo varchar(100)

Xid  id         create_date             foo
1268 13129    29/10/2008 16:00    62459710
1269 13130    29/10/2008 16:00    62459710
1270 13131    29/10/2008 16:00    62459710
1271 13132    29/10/2008 16:00    62459710
1272 13133    29/10/2008 16:00    62459710
1273 13129    29/10/2008 16:00    62459710
1274 13130    29/10/2008 16:00    62459710
1275 13131    29/10/2008 16:00    62459710
1276 13132    29/10/2008 16:00    62459710
1277 13133    29/10/2008 16:00    62459710


There are multiple entries for foo value. How do you say keep the block of ids that begin with the higher Xid. So in this example foo 62459710 has id block (13129 - 13133) which is repeating. How do I delete the first block Xid (1268 - 1272) but keep that highlighted (ie the block with the greatest Xid values) in bold above?

Thanks for replies

 

RE: Dynamic delete

(OP)
Sorry to follow up but the data I'm working on is particularly poor. In my original example the repeating foo value associated with the id blocks was always the same. However it also seems that the foo value associated with a repeating block of ids [b]can be different[b] as you can see so the repeating id is really the key. So given the table below how is it possible to say for the batch of ids (13129-13133) irrespective of foo value, choose the higher block of Xids?

Xid  id         create_date             foo
1268 13129    29/10/2008 16:00    12763989
1269 13130    29/10/2008 16:00    12763989
1270 13131    29/10/2008 16:00    12763989
1271 13132    29/10/2008 16:00    12763989
1272 13133    29/10/2008 16:00    12763989
1273 13129    29/10/2008 16:00    62459710
1274 13130    29/10/2008 16:00    62459710
1275 13131    29/10/2008 16:00    62459710
1276 13132    29/10/2008 16:00    62459710
1277 13133    29/10/2008 16:00    62459710

Thanks for replies.

RE: Dynamic delete

(OP)
Thanks, * hangs head in shame *

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close