[eluser]chubbypama[/eluser]
Hi there. I would like to write a query that returns the latest record in a table. Actually, it's a little more complicated than that but right now, i can't seem to get the basic order by working.
Here's what i have:
Code:
$this->db->order_by('updated','desc');
$this->db->group_by('ip);
but it returns the first record.
I tried changing my code to :
Code:
$this->db->order_by(DATE_FORMAT('%Y-%m-%d','updated'),'desc');
but the syntax is incorrect.
the sql that generates is SELECT * FROM MYTABLE GROUP BY 'ip' ORDER BY 'desc
any help would be appreciated.
thanks.