Reply to Re: identical named field names in multiple tables

Your name:

Reply:


Posted by JDS on 11/11/05 19:24

On Thu, 10 Nov 2005 15:43:38 -0800, Dave Smith wrote:

> I am joining three tables all of which contain the same field name.
> example:
> CLNT_STATS_YTD.Vol_Collected
> CLNT_STATS_MTD.Vol_Collected
> CLNT_STATS_TD.Vol_Collected
>
> If I try to reference them using those names I get no data. If I use the
> last half "Vol_Collected" I get the last value of the three. I'm not
> sure how to reference them seperately in php. Thank you for any help.
>
> Dave

I'm sure somebody already answered this, but here goes...

You have to use column "aliases" in the SQL statment:

SELECT CLNT_STATS_YTD.Vol_Collected as "ytd_collected"
, CLNT_STATS_MTD.Vol_Collected as "mtd_collected"
, CLNT_STATS_TD.Vol_Collected as "td_collected"
FROM whatever;

--
JDS | jeffrey@example.invalid
| http://www.newtnotes.com
DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация