Home > Backend Development > PHP Tutorial > MYSQL 关联表 统计请教

MYSQL 关联表 统计请教

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 13:14:42
Original
986 people have browsed it

有2个表A,B
表A
uid  gender    (1男,2女)
1     1
2     2
3     1
4     2
5     1
表B
uid   department  (1客服部,2运营部)
1    1
2    1
3    2
4    2
5    1

怎么样写 SELECT COUNT(*),可以

统计   客服部,男性的 数量

谢谢


回复讨论(解决方案)

 SELECT COUNT(*) from A, B where A.uid=B.uid and A.gender =1 and B.department=1

谢谢版主

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template