Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating every second or third row

Status
Not open for further replies.

seosamh

Programmer
Aug 2, 2000
29
IE
I need to update every second or third row in a table. There is very little to differentiate particular rows, so manually updating them is not really an option. [sig][/sig]
 
Add an extra column (ID) with an identity starting at 1
Then you can do use the modulo function (%) to get every other row:
SELECT * FROM TABLE WHERE (ID % 2) = 0
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top