Join queries - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Join queries (/showthread.php?tid=22180) |
Join queries - El Forum - 08-31-2009 [eluser]Jacob Graf[/eluser] I am trying to figure this out and can't seem to come up with anything. I have one table that holds participants and another table that holds family member participants for those original participants. I am trying to make a list of all participants (Participants AND sub-participants) and have it sorted by last_name field. Any ideas how I could accomplish something like this? Thanks in advance for your help! Join queries - El Forum - 09-01-2009 [eluser]Dam1an[/eluser] If I understand right, you might be better off looking into a UNION instead of a join It should be a simple case of doing a select on each table and UNIONing the results with an order clause Join queries - El Forum - 09-01-2009 [eluser]Jacob Graf[/eluser] Ahh. Never heard of the UNION statement. Looks like exactly what I want! Does CI support any of this functionality or will I just have to use generic queries? Thanks for your help! Join queries - El Forum - 09-01-2009 [eluser]Dam1an[/eluser] Yeah union is a little gem A quick look at the UG, and it appears there's no AR class for unions, so looks like you'll have to do it in plain SQL |