I need to create a query like this:
SELECT * FROM `table1` WHERE `date1` < `date2`
I can not find how to compare 2 columns in kohan ORM. Here, date2 is considered text.
$foo = ORM::factory('model1')->where('date1','<','date2');
How can I write this line?
Thank!
Additional Information:
I am using this at the moment:
$query = DB::query(Database::SELECT, "SELECT id FROM table1 WHERE `date1` < `date2`");
$result = $query->execute();
$foo = array();
foreach ($result as $r) {
$foo[] = ORM::factory("model1", $r['id']);
}
source
share