由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - MySQL 的一个问题求教
相关主题
这种insert怎么做SQL help.
[合集] 这种insert怎么做Re: How to find a duplicate record in Ac
How to split a column into several rows?list duplicators in one table
MySQL语句请教Help on Sql server huge table performance
how to find duplicates in mysqlmysql C API
A weird errorhow to write this sql statement
urgent help! insert value into tableSQL Server insert speed too slow! Help?
help with SAS sql (转载)How to find a duplicate record in Access?
相关话题的讨论汇总
话题: null话题: cancel话题: user话题: 5339话题: 5336
进入Database版参与讨论
1 (共1页)
s******c
发帖数: 87
1
清除duplicate user_id,但是保留值只是cancel=0的user_id,cancel=1的删除。
只有在cancel=1的时候才有duplicate。
result of user_id which are 5340, 5339,178,206,5336.

id plan_id user_id date_applied backup_plan_id restored_date
cancel cancel_date stop_wishlist
2707 1 5340 41533.74321 NULL NULL 0 NULL 0
2708 2 5339 41533.74399 NULL NULL 0 NULL 0
48 2 178 05/16/13 NULL NULL 1 NULL 0
49 2 206 5/16/2013 15:20 1 10/16/13 1 41492.13
Past Due 0
2706 8 5339 41533.74237 NULL NULL 1 41533.74 0
2700 8 5336 41533.70549 NULL NULL 1 41533.71 0
2703 2 5336 41533.70984 NULL NULL 0 NULL 0
s********e
发帖数: 893
2
只有在cancel=1的时候才有duplicate是什么意思?178 的cancel=1,可是没有
duplicate啊。
y*****g
发帖数: 677
3
你可以用一个临时表格做, 比如:
CREATE TABLE temp as user;
-- add unique key
create unique index idx on temp(id);
导入DUPLICATES,
insert ignore into temp select * form user where cancel=1;
删除duplicates
INSERT INTO user where CANCEL=1;
然后merge 数据
insert into user select * from temp;
当然也可以用 self -join实现, 保留最后一个user_id in duplicates.
s******c
发帖数: 87
4
回答上面的问题
1.178 是被返回值
2. 数据在myphpadmin系统里面是mysql,有可能直接online写语句得到结果?
谢谢
1 (共1页)
进入Database版参与讨论
相关主题
How to find a duplicate record in Access?how to find duplicates in mysql
求教:数据操作A weird error
a simple question about inserturgent help! insert value into table
[转载] Can anyone interpret this simple SQL?help with SAS sql (转载)
这种insert怎么做SQL help.
[合集] 这种insert怎么做Re: How to find a duplicate record in Ac
How to split a column into several rows?list duplicators in one table
MySQL语句请教Help on Sql server huge table performance
相关话题的讨论汇总
话题: null话题: cancel话题: user话题: 5339话题: 5336