Jerry Schwartz wrote:
-----Original Message-----
From: Andy Shellam [mailto:andy-li...@networkmail.eu]
Sent: Wednesday, December 17, 2008 3:29 PM
To: Lamp Lists
Cc: mysql@lists.mysql.com
Subject: Re: need help with query...

Hi Afan

Why not prefix your field names with the table name?

select
 p.first_name AS person_first_name,
 p.last_name AS person_last_name,
 p.status AS person_status,
 p.date_registered AS person_date_registered,
 o.org_id AS organization_org_id,
 o.org_name AS organization_org_name,
 o.org_department AS organization_org_department,
 a.addres1 AS addresses_address1,
 a.address2 AS addresses_address2,
 a.city AS addresses_city,
 a.state AS addresses_state,
 a.zip AS addresses_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

[JS] That would only retrieve a person_id if it is all three tables. I'm not
sure that's what is wanted.

That was the original query as specified by the original poster - I just added the "AS xxx" to each field he'd selected.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to