通过本文主要向大家介绍了sql实用语句,sql语句总结,sql语句优化总结,sql语句大全,sql语句等相关知识,希望本文的分享对您有所帮助
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 # </div>
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 # </div>