Home > Backend Development > PHP Tutorial > SQL语句中IN的有关问题

SQL语句中IN的有关问题

WBOY
Release: 2016-06-13 13:17:34
Original
917 people have browsed it

SQL语句中IN的问题
我的usersys表是这样的

submit_user表是

我的SQL语句是:
SELECT fullname, sum( jkd ) 
FROM submit_user
WHERE fullname
IN (

SELECT fullname
FROM usersys
WHERE Department = '影像制作部'
)
AND submit_date
BETWEEN '2012-08-09'
AND '2012-08-26'

但是得到的结果就不对,结果是

本来应该得到的是该部门全部人员jkd的和,但是就只出来一个人的,真是奇怪了,请各位帮我看看,哪里有问题?

------解决方案--------------------
SELECT fullname, sum( jkd ) 
FROM submit_user
WHERE fullname
IN (

SELECT fullname
FROM usersys
WHERE Department = '影像制作部'
)
AND submit_date
BETWEEN '2012-08-09'
AND '2012-08-26'
group by fullname

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