Join queries

#1
[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!

#2
[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

#3
[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!

#4
[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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.