>From: Lamp Lists [mailto:lamp.lists@stripped]
>Sent: Wednesday, December 17, 2008 2:57 PM
>Subject: need help with query...
>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?
[JS] Admittedly I'm not really good with this stuff, but I think this works:
SELECT 'table1' AS tablename, person_id FROM table1 WHERE person_id = 123
SELECT 'table2', person_id FROM table2 WHERE person_id = 123
SELECT 'table3', person_id FROM table2 WHERE person_id = 123;
That would give you all of the tables in which a particular person_id is
I don't know if this suits your needs.
The Infoshop by Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341