06-20-2012, 05:59 AM
[eluser]iamzozo[/eluser]
Hi!
I've created a query
It's working fine, but i would like the result show up something like this:
[id] => 1,
[title] => Lorem ipsum,
[child_titles] => Array()....
Now it gives in each object the a.title (as join work).
- I did it with two query, but is it possible to create this with one query?
- Has the two query (much) slower performance (one row query, one list)? - "a" table has got aprox 30K rows, "b" has got aprox. 600K.
Thanks!
Hi!
I've created a query
Code:
$this->db->select('a.id, a.title, b.child_title');
$this->db->from('a');
$this->db->where('a.id', $id);
$this->db->join('b','a.id = b.parent');
$this->db->get();
It's working fine, but i would like the result show up something like this:
[id] => 1,
[title] => Lorem ipsum,
[child_titles] => Array()....
Now it gives in each object the a.title (as join work).
- I did it with two query, but is it possible to create this with one query?
- Has the two query (much) slower performance (one row query, one list)? - "a" table has got aprox 30K rows, "b" has got aprox. 600K.
Thanks!