between clause |
[eluser]PHP Programmer[/eluser]
How can I use between clause in my SQL query? I want to calculate the number of days occur in the dates between 2008-09-20 00:00:00 and 2008-10-01 00:00:00 TIA
[eluser]manilodisan[/eluser]
Code: SELECT * FROM people WHERE height BETWEEN 12 AND 16 Reference: http://dev.mysql.com/doc/refman/5.0/en/c...or_between
[eluser]PHP Programmer[/eluser]
manilodisan I want to do it in CodeIgniter. As there is no clause for 'between' in codeigniter. I have searched it in userguide.
[eluser]Dready[/eluser]
Hello, just use the query method of the db object. That gives, with manilodisan example : Code: $res = $this->db->query('SELECT * FROM people WHERE height BETWEEN 12 AND 16');
[eluser]xwero[/eluser]
Or you could do Code: $this->db->where('height','BETWEEN 12 AND 16',FALSE);
[eluser]miky4e[/eluser]
[quote author="xwero" date="1222871662"]Or you could do Code: $this->db->where('height','BETWEEN 12 AND 16',FALSE); This is the best solution
|
Welcome Guest, Not a member yet? Register Sign In |