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

SQL语句中IN的有关问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 13:17:34
Original
930 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:
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
Latest Issues
Why can’t my submit button submit data?
From 1970-01-01 08:00:00
0
0
0
Ajax click submit but no response!
From 1970-01-01 08:00:00
0
0
0
Click submit but nothing shows up
From 1970-01-01 08:00:00
0
0
0
git submit issue
From 1970-01-01 08:00:00
0
0
0
angular.js - angular's ng-submit does not trigger
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template