高分求SQL

armi514 2005-12-16 10:51:16
表book 有字段 tejia
表art 有字段 tejia

列出book.tejia=1与art.tejia=1 所有记录语句如下
select bookname from book where tejia='1' union select artname from art where tejia='1'

现问 

1、想求出book.tejia=1 与art.tejia=1 所有记录的总数怎么写
2、如果想加上 LIMIT 0,10 列出 book.tejia=1 与art.tejia=1 的语句应该怎么写?

谢谢大侠
...全文
98 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hy2003fly 2005-12-16
  • 打赏
  • 举报
回复
第2问,你试试这样行不行?
mysql>select bookname from book where tejia='1' union select artname from art where tejia='1' limit 0,10;
hy2003fly 2005-12-16
  • 打赏
  • 举报
回复
你看这句行不行?
mysql>select count(bookname)+count(artname) from book,art where book.tejia='1'
>and art.tejia='1';
armi514 2005-12-16
  • 打赏
  • 举报
回复
自己再顶一下
armi514 2005-12-16
  • 打赏
  • 举报
回复
有没有大侠知道?

56,687

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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