比较实用SQL语句总结
时间:2021-01-27 10:38:18|栏目:|点击: 次
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 #
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 #
上一篇:WINDOWS XP终极设置(呕心沥血版)第1/2页
栏 目:
下一篇:Powershell小技巧之通过EventLog查看近期电脑开机和关机时间
本文标题:比较实用SQL语句总结
本文地址:http://www.codeinn.net/misctech/51930.html






