2013年6月28日

sqlserver查询重复记录

摘要: 1.查询某一列或多列的重复记录,只能查出重复的值,不能列出整条记录的信息selectid,name from tbgroupby id,namehaving(count(*))>12.查询某一列重复的记录,并列出全部select*from tbwhereid in (select stuid from stuinfogroupby stuidhaving(count(*))>1)3.查询某一列重复的记录,列出多余的记录,比如重复三条,列出多余的两条前提:需要有一个不重复的列,例如下例中的recno,重复的是stuidselect*from stuinfo s1where recno 阅读全文

posted @ 2013-06-28 13:35 awk 阅读(464) 评论(0) 推荐(0)

Mssqlserver命令行

摘要: 1.查询可用数据库,排除系统库select * from sysdatabases where dbid>42.查询可用表,排除系统表select * from sysobjects where xtype='u'3.删除/建立数据库drop/create database students;4.删除/新建表drop table tablename;create table tb (id int,name varchar(20),sex varchar(20))5.插入记录insert into tb (id,name,sex) values ('1',& 阅读全文

posted @ 2013-06-28 12:58 awk 阅读(215) 评论(0) 推荐(0)

导航