[SQL] Search for available personnel |
Hi there!
I have a table with jobs in my app. Here it is with a from date and to date and of course the employee_id. I want to list everyone that is available between two dates. Whats the best practice for this? Thanks. PHP Code: SELECT * What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
@user4852
...or (https://www.codeigniter.com/userguide3/d...y-bindings ) $sql = "SELECT * FROM order_details Where your_date >= ? and your_date <= ?"; $this->db->query($sql, array('2014-02-01', '2014-02-28')); or If you have to cast the strings as dates... $sql = "SELECT * FROM order_details Where your_date >= CAST(? as DATE) and your_date <= CAST(? as DATE)"; $this->db->query($sql, array('2014-02-01', '2014-02-28')); |
Welcome Guest, Not a member yet? Register Sign In |