易截截图软件、单文件、免安装、纯绿色、仅160KB

MYSQL 查找出重复列值 - MS-SQL Server / 疑难问题

DB: MySql

Problem:

create table aaa(
  id int primary key,
  phone varchar(100),
  name varchar(50)
)

insert into aaa values(000101,'111','jackie');
insert into aaa values(000102,'222','milk');
insert into aaa values(000103,'111','lucy');
insert into aaa values(000104,'111','mechelle');
insert into aaa values(000105,'222','tom');
insert into aaa values(000106,'333','roy');

查找出phone列有重复的值,即count(phone)>=2的值列出来

Required Result:
phone num
111 3
222 2

请高手解答,在线等,谢谢


SQL code:
select phone,
count(*)num
from aaa
group by phone
having count(*)>=2


SQL code:
create table aaa(
id int primary key,
phone varchar(100),
name varchar(50)
)

insert into aaa values(000101,'111','jackie');
insert into aaa values(000102,'222','milk');
insert into aaa values(000103,'111','lucy');
insert into aaa values(000104,'111','mechelle');
insert into aaa values(000105,'222','tom');
insert into aaa values(000106,'333','roy');
select phone,
count(*)num
from aaa
group by phone
having count(*)>=2
drop table aaa
/*
phone


相关问答:

Asp+sql server问题 - Web 开发 / ASP

我一个项目,有个插入操作,具体是这样的:
我有进货信息表。在出货时选择相应的进货信息,输入数量,选择部门后,点保存按钮,由于网络延时,点一下没有反映,于是用户就又点一下,导致一次插入了两条记录:
例: ......

mysql连接tomcat - Java / Web 开发

我已经按照教程上配置tomcat的server.xml
<Context path = "/POS" docBase = "POS" debug = "5" reloadable = "true" crossContext = "true" workDir = &quo ......

数据以xml格式返回 - MS-SQL Server / 应用实例

从数据库中查询一张表的数据
select 部门,姓名 from tb
如何才能生成下面的xml格式
XML code:
<folder state="unchecked" label="全部">
   <folder state="unchecked&qu ......

mysql问题! - Java / Java SE

String sqlCount="select count(*) from usertable where username='"+
userName+"'";这句话 什么意思啊!
这句话输出出来就是
select count(*) from usertable where username='你的变量 ......

mysql运用问题 - PHP / 基础编程

php同时调用3个数据库中的一个表的信息(架设A.a.aid=B.b.bid=C.c.cid),请说明思路及书写部分代码
例如:
SELECT time, goodid from dbname1.time, dbname2.goods
是这个意思么?

SELECT time, goodid from ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号