id name
1 a
2 b
3 c
1 a
2 b
3 c
以下的sql語句都以上面表mytable為准:
1、查詢id=1,3記錄的所有數據 select * from mytable
where id in(1,3)
2、刪除id重復的數據,表中數據只剩下id=1,2,3的所有數據 select * into # from mytable
truncate table mytable
insert table select distinct * from #
select * from table
drop table #