List:General Discussion« Previous MessageNext Message »
From:Andy Shellam Date:December 17 2008 8:43pm
Subject:Re: need help with query...
View as plain text  

Jerry Schwartz wrote:
>> -----Original Message-----
>> From: Andy Shellam [mailto:andy-lists@stripped]
>> Sent: Wednesday, December 17, 2008 3:29 PM
>> To: Lamp Lists
>> Cc: mysql@stripped
>> 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.

Thread
MySQL 5.0.67 on SMPxufeng16 Dec
  • Re: MySQL 5.0.67 on SMPDan Nelson16 Dec
    • RE: MySQL 5.0.67 on SMPxufeng17 Dec
  • Re: MySQL 5.0.67 on SMPewen fortune16 Dec
  • need help with query...Lamp Lists17 Dec
    • Re: need help with query...Jason Pruim17 Dec
      • Re: need help with query...Andy Shellam17 Dec
        • RE: need help with query...Jerry Schwartz17 Dec
          • Re: need help with query...Andy Shellam17 Dec
    • RE: need help with query...Jerry Schwartz17 Dec
  • Re: need help with query...Lamp Lists17 Dec
    • Re: need help with query...Andy Shellam17 Dec
  • Re: need help with query...Lamp Lists17 Dec
RE: MySQL 5.0.67 on SMPxufeng16 Dec
  • Re: MySQL 5.0.67 on SMPJoerg Bruehe16 Dec