first attempt
SELECT s.name,s.email,s.student_id,a.hostel_id,s.image,s.course_id,s.year, s.address
FROM sys_student_account s, sys_room_allotment a
WHERE s.student_id!=a.student_id AND s.name like 'SAMS%'
GROUP BY s.student_id ORDER BY s.name LIMIT 0,20
second attempt
SELECT s.name,s.email,s.student_id,a.hostel_id,s.image,s.course_id,s.year, s.address
FROM sys_student_account s, sys_room_allotment a
WHERE NOT(s.student_id=a.student_id) AND s.name like 'SAMS%'
GROUP BY s.student_id ORDER BY s.name LIMIT 0,20
can anyone help me please?