Brief: I'm making a hostel management system. I have the following 4 tables named as 'users' having users info, 'rooms' table having rooms' info, 'reservation' having info about rooms reserved by any user, and fee table having roomid, userid that has reserved the room. Fee is generated when the reservation request is confirmed.
Problem Statement:
I want to select all users' info who have paid or not fee of the current month and also the name of the room that has been reserved by the user. Keep in mind that reservation status should be confirmed
I have used this query: SELECT u.* FROM users u WHERE u.userid NOT IN ( SELECT f.user_id FROM fee f WHERE month(f.feemonth) = EXTRACT(month FROM (NOW())) ) but it doesn't show me the room name and fee info such as fee month, fee status paid fee. If you think I should change the strategy please suggest it. Tables structure is given as: users table rooms table reservation table fee table