SELECT COUNT ( `HA` . `HomeworkId` ) AS `SubmittedHomeworkCount` FROM `thomeworkassign` `HA` LEFT JOIN `thomeworksubmittedanswer` `HSA` ON `HA` . `HomeworkId` = `HSA` . `HomeworkId` WHERE `HA` . `StatusId` = ? AND `HA` . `HomeWorkId` = ? 