-----Original Message-----
From: Ryan Morgan, Aerials Express [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 1:58 PM
To: Jason Adam
Subject: RE: MI-L Delete every third record SUM


Thanks to Tim, Micheal, Jacques, Jason, and Cameron for the answer:

Try:

Select * from TABLE Where rowid/3 = int(rowid/3) into DELETETHESE
Delete from DELETETHESE

or something along those lines.

Ryan-
That's perfect use for the MOD function.  It returns the "remainder" when a
number is divided.
For example, do a simple select on your table and specify a "where" value of
rowid mod 2 = 0
that will select any row that when divided by 2 has a remainder of 0 (ie it
divides evenly, like 2,4,6,8 etc)
Likewise with "rowid mod 3 = 0" (returns every 3rd row -  3,6,9,etc)
rowid mod 5 = 0 (returns every fifth row  -  5,10,15 etc)



OK, I'm stumped...

Anyone know how to delete every third record from a table automatically?

Thanks!

Ryan Morgan
Aerials Express

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 5481


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 5484

Reply via email to