热搜:NVER 

SQL语句中IN的有关问题

2024-04-29 18:19:10
 SQL语句中IN的有关问题

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