if/then INNER JOIN
Posted: Tue Oct 27, 2009 8:49 am
Hello,
The query below returns everything requested but I would like to modify it so that if there is no project_id (and therefore, no project.name), it will still pull that record.
Any help would be appreciated. Thanks.
The query below returns everything requested but I would like to modify it so that if there is no project_id (and therefore, no project.name), it will still pull that record.
Any help would be appreciated. Thanks.
Code: Select all
function awardsList($year)
{
$query = $this->db->query("
SELECT award_detail.award, award_detail.organization, award.year, project.name
FROM award_detail
INNER JOIN award ON award.id = award_detail.award_id
INNER JOIN project ON project.id = award.project_id
WHERE award.year = $year
ORDER BY award_detail.id DESC
");
return $query->result();
}