[eluser]Robert May[/eluser]
Just a quick question: is it possible to use the join command on a query based on whether an entry actually exists?
Here's the query:
Code:
function list_entries($number, $offset)
{
$this->db->select('*');
$this->db->join('authors', 'author_id = news_author_id');
$this->db->join('translations', 'trans_ref_id = news_id');
$this->db->order_by('news_id', 'desc');
$query = $this->db->get('news', $number, $offset);
return $query->result();
}
The one that is causing trouble is the translations bit. I want it to only join if the translation actually exists, rather than creating an error.
The only other way I can see to do it is to create blank records for every news article, though I'm probably wrong. Any ideas?