How to query sql with active record for dates between specified times

后端 未结 5 1829
执念已碎
执念已碎 2020-12-16 18:25

I have a database that I want to pull only certain rows that have dates in specified ranges. I\'m not sure how to do this properly in active record. Right now it looks like

5条回答
  •  悲&欢浪女
    2020-12-16 18:25

    You can specify you $where and use active records

    $where = "DATE(order_datetime) BETWEEN '2012-10-01' AND '2012-10-3'";
    $this->db->where($where)->get('table_name');
    

提交回复
热议问题