首页 新闻 会员 周边 捐助

一条sql 问题

0
[已解决问题] 解决于 2009-06-29 14:16

表A:

BOOK是字段

A

B

C

D

E

B

C  

       

要输出的结果是:

BOOK                      SUMCOUNT

B                                      2

C                                      2

like%'远远'%的主页 like%'远远'% | 小虾三级 | 园豆:635
提问于:2009-06-23 19:02
< >
分享
最佳答案
0

select distinct BOOK ,count(BOOK) as 'SUMCOUNT' form A group by

BOOK having count(book)>1

丽力 | 初学一级 |园豆:82 | 2009-06-28 15:31
其他回答(3)
0
SELECT DISTINCT BOOKID ,COUNT(BOOKID) AS 'SUMCOUNT' 

FROM DBO.BOOK GROUP BY

BOOKID
HAVING BOOKID IN('B','C')

 

这是最最基本的Group by,属于面试必考. 

 

try{Phoenix} | 园豆:95 (初学一级) | 2009-06-23 20:12
0

看一下分组的SQL语句就可以了。

侯垒 | 园豆:3435 (老鸟四级) | 2009-06-23 20:38
0

select distinct Book ,count(Book) from A
group by Book
having count(Book) > 1

sansan- | 园豆:163 (初学一级) | 2009-06-24 19:50
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册