You have to either group by the columns in the first query, or pick one row out of the multiple rows from each group. If you want to group by , you need to decide what you want to do for the multiple values from test table. For example, you might decide that you want the max of the testname and sum of the totalpoints. If so, do like this:SELECT p.firstname , p.lastname , a.assignmentname , asg.pointsawarded , a.pointspossible , a.duedatetime , asg.submissiondatetime , MAX(t.testname) AS testname , SUM(t.totalpoints) AS totalpointsFROM person2 p INNER JOIN coursesectionroster cs ON cs.personid = p.personid INNER JOIN assignment a ON a.coursesectionid = cs.coursesectionid INNER JOIN test t ON t.coursesectionid = cs.coursesectionid LEFT JOIN assignmentsubmission asg ON a.assignmentid = asg.assignmentidWHERE cs.coursesectionid = 'b78a6efe-ac77-4e49-806a-fc2fad71068b' AND cs.courserole = 2 AND a.gradebook = 1GROUP BY p.firstname , p.lastname , a.assignmentname , asg.pointsawarded , a.pointspossible , a.duedatetime , asg.submissiondatetime
But this is only an example. Depending on the logic you want to implement, you might have to do something different.