|
|||||||
| SQL For all Structured Query Language, and general database questions. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Update on 80% of Records
Hi all,
I have a table presently containing 40,905 rows. I would like to run a query that will update the 'marker' field on 80% of these records. Something like... Code:
UPDATE comments SET marker = 'Foo' WHERE id IN (SELECT RANDOM 80% FROM comments) Thanks! dai.hop |
|
#2
|
|||
|
|||
|
Whan database are you using? 40k rows is nothing unless each row is 1GB each.
|
|
#3
|
|||
|
|||
|
It's MySQL version 4.1.11
|
|
#4
|
|||
|
|||
|
Ugggh. Don't you think its time to upgrade?
Here is on MSSQL Code:
update comments set marker = 'foo' where id in (select top (FLOOR(4 * (SELECT COUNT(*) FROM comments ) / 5)) id from comments ORDER BY NEWID()) |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|