I have this sql query which is giving me a result which is not complete(half result).
I want to retrieve all students info from the same class which is from the student table, then group them by class.
This are the queries code.
SELECT first_name, last_name, username FROM students GROUP BY class
HAVING class IN(SS3);
SELECT first_name, last_name, class FROM students GROUP BY class
HAVING class = 'JSS1';
COUNT(*) AS total_students
HAVING class IN ('JSS1')
The last query also display just only one info, which is the first "jss1" class student name in the table
but this time shows that there are 17 students who are in jss1
How do I manipulate the query to display all the names of the students in the same class
This is the table structure
CREATE TABLE IF NOT EXISTS `students` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`class` varchar(10) NOT NULL,
`first_name` varchar(30) NOT NULL,
`last_name` varchar(50) NOT NULL,
`username` varchar(20) NOT NULL,
PRIMARY KEY (`user_id`)