I have two tables
Students table :
id studentname admissionno 3 test3 3 2 test2 2 1 test 1
2nd table is fee :
id studentid created 1 3 2015-06-06 22:55:34 2 2 2015-05-07 13:32:48 3 1 2015-06-07 17:47:46
I need to fetch the students who haven't paid for the current month,
I'm performing the following query:
SELECT studentname FROM students WHERE studentname != (select students.studentname from students JOIN submit_fee ON (students.id=submit_fee.studentid) WHERE MONTH(CURDATE()) = MONTH(submit_fee.created)) ;
and I'm getting error:
'#1242 - Subquery returns more than 1 row'
Can you tell me what the correct query is to fetch all the students who haven't paid for the current month?