Welcome Guest, Not a member yet? Register   Sign In
how to do multiple selects and arithmetic using Active Record
#2

[eluser]Seppo[/eluser]
Code:
$this->db->select('value_SI, description');
$this->db->from('values');
$this->db->where("value_SI < (SELECT 1/(SELECT convert2SI FROM `units` WHERE unit='hands'))");
$this->db->order_by("value_SI", "DESC");
$this->db->limit(4);

That generates, in mysql driver,
Quote:SELECT `value_SI`, `description` FROM (`values`) WHERE `value_SI` < (SELECT 1/(SELECT convert2SI FROM `units` WHERE unit='hands')) ORDER BY `value_SI` DESC LIMIT 4

it is not as good as AR could be, because it probably won't work on all db systems, but it's the best you can do...


Messages In This Thread
how to do multiple selects and arithmetic using Active Record - by El Forum - 02-20-2008, 08:19 PM



Theme © iAndrew 2016 - Forum software by © MyBB