1
How to sort fields of type VARCHAR
in class model
codeigniter?
Already achieve in pure SQL that way:
order by strtodate(dtdespesa, '%d-%m-%Y') desc;
However, the version of Codeigniter I am using, 3.1.6, does not recognize this function: strtodate
.
$this->db->order_by (strtodate('dtandamento', '%d/%m/%Y'));
- IC Version: 3.1.6
- PHP version 5.3.7
Puts codeigniter code forming query with function
– Sveen
$this->db->order_by (strtodate('dtandamento', '%d/%m/%Y'));
– Ramiro
the function is working fine, what is picking up is the order_by
– Ramiro
have tried:
$this->db->order_by("strtodate('dtandamento', '%d/%m/%Y')", 'ASC', FALSE);
?– novic
@Virgilionovic, I just tried. Gave the same message: Message: Call to Undefined Function strtodate()
– Ramiro
put all the code!
– novic
It worked!!! I just added the name of the other table and ordered it the way I wanted. Many thanks @Virgilionovic $this->db->order_by ("str_to_date(tempo.dtandamento, '%d-%m-%Y')", 'DESC', FALSE);
– Ramiro
Ramiro I put as an answer!
– novic