摘要:
delete table where id not in ( select max(id) from table group by col1,col2,col3...)group by 子句后跟的字段就是你用来判断重复的条件,如只有col1,那么只要col1字段内容相同即表示记录相同。 阅读全文
摘要:
项目中碰到字符串分解问题,做一个简单的例子来标记一下 1declare @ids varchar(300) 2set @ids='1,3,4' 3if(right(@ids,1)',') 4begin 5 set @ids=@ids +',' 6end 7declare @Id int 8while CHARINDEX(',',@ids)>0 9begin10 SELECT @Id=LEFT(@... 阅读全文