如何写这样的SQL 的语句?

rainlow 2004-09-21 06:04:07
有一张表A,里面存放了一些书的信息(bookname,author--作者,price...),现在要选出author写过两本以上几上的书籍.
...全文
84 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhangzs8896 2004-09-21
  • 打赏
  • 举报
回复
select a.* from 表 a
inner join (select author from 表 group by author having count(author)>=2)b
on a.author=b.author
yyhyy23 2004-09-21
  • 打赏
  • 举报
回复
select author from tb group by author having count(author)>=2
Andy__Huang 2004-09-21
  • 打赏
  • 举报
回复
select author from tb group by author having count(author)>=2
zlj113 2004-09-21
  • 打赏
  • 举报
回复
select * from u_table where author=(select author from u_table group by author having count(*)>2)


想当然写的,没测试,错了不负责:)
lsxaa 2004-09-21
  • 打赏
  • 举报
回复
select * from 表 aa where (select count(*) from 表 where author=aa.author)>=2

34,587

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧