Welcome Guest, Not a member yet? Register   Sign In
combining multiple activerecord queries
#1

[eluser]walrusk[/eluser]
Hey there

I'm pretty new to activerecord and mysql, but I'm picking it up quick so bear with me!

My question is whether or not it is possible to combine the following two queries into one:

Code:
$this->db->where('id',$this->uri->segment(3));
$data['folder'] = $this->db->get('folders');
            
$this->db->where('folder_id',$this->uri->segment(3));
$data['files'] = $this->db->get('files');

Basically I'm displaying a page of files contained in one folder. I also need the single row from the folder table so that I can display the folder title and other info.

I've looked into joins a bit, and I think I understand them somewhat, but I'm not sure if I can use them in a situation like this - can I? If not: is there another way to achieve this?

Any help is much appreciated! Thanks to all you Igniters of Code!


Messages In This Thread
combining multiple activerecord queries - by El Forum - 01-21-2010, 04:33 PM
combining multiple activerecord queries - by El Forum - 01-21-2010, 04:36 PM
combining multiple activerecord queries - by El Forum - 01-23-2010, 05:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB