I hate when somebody put in Subject line something like I just did but after 15 
minutes to try to be specific just with one short sentence - I gave up. So, you 
can hate me - I understand (though, help with my problem too) :-)


I have let say 3 tables people, organization, addresses. and they are linked to 
each other with column person_id.
to select person by specified person_id it's not big deal, really simple. 
though, I wonder how can I select records from these three tables but somehow 
marked which table it belongs?

e.g.

select p.first_name, p.last_name, p.status, p.date_registered, o.org_id, 
o.org_name, o.org_department, a.addres1, a.address2, a.city, a.state, a.zip
from people p, organization o, addresses a
where p.person_id=123 and o.person_id=p.person_id and a.person_id=p.person_id

I need somehow, together with result data, info which table data belogs?

e.g.
not exactly this way but something like this:
$data = array(
    'people' => array('lamp', 'lists', 1, '2008-12-12'), 
    'organization' => array(56, 'Lamp List', 'web'), 
    'addresses' => array('123 Main St.', 'Toon Town', 'NY', '12345')
}
  
thanks for any help.

-afan



      

Reply via email to