例如有一张表的表结构和数据如下:
user_date city_id platform_id hd_flag user_type user_num
------------------------ ----------- ----------- ----------- ----------- -----------
20141014 0 2 0 0 2321899
20141014 0 2 1 0 244374
20141014 0 1 0 0 1712988
20141014 0 1 1 0 108189
20141014 0 3 0 0 587797
20141014 0 0 0 0 105619
20141014 0 2 0 1 279
20141014 0 2 1 1 358
20141014 0 1 0 1 613
20141014 0 1 1 1 282
20141014 0 3 0 1 432
20141014 0 0 0 1 397
20141014 0 1 1 2 46
20141014 0 1 0 2 580
20141014 0 2 1 2 120
20141014 0 2 0 2 741
20141014 0 3 0 2 79
20141014 0 0 0 2 69
20141014 0 2 0 0 2321899
20141014 0 2 1 0 244374
20141014 0 1 0 0 1712988
20141014 0 1 1 0 108189
20141014 0 3 0 0 587797
20141014 0 0 0 0 105619
20141014 0 2 0 1 279
20141014 0 2 1 1 358
20141014 0 1 0 1 613
20141014 0 1 1 1 282
20141014 0 3 0 1 432
20141014 0 0 0 1 397
20141014 0 1 1 2 92
20141014 0 1 0 2 1160
20141014 0 2 1 2 240
20141014 0 2 0 2 1482
20141014 0 3 0 2 158
20141014 0 0 0 2 138
我们要删除其中国的重复字段;思路:找出重复行的rowid
1> select rowid(itv_user_tmp) from itv_user_tmp where user_date='20141014' and city_id=0
2> go
rowid(itv_user_tmp)
-----------------------
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
删除重复行的rowid
delete from itv_user_tmp where rowid(itv_user_tmp)>=9525 and rowid(itv_user)<=9542