On Dec 17, 2008, at 2:56 PM, Lamp Lists wrote:
> 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?
> 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
> I need somehow, together with result data, info which table data
> 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.
It may not be the best option, but when I've done that type of stuff
in the past, I add another field to the database and call it like
"List" and put "People" in the people database. and then you could
just query the field List and display it how ever you needed.