thx Jason,
now I understand the use of aliases in select queries. Good ID:-) Wilbert ----- Original Message ----- From: "Jason Wong" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, July 04, 2002 11:38 AM Subject: Re: [PHP] mysql/php how to retrieve the right column with 2 columns of the same name > On Thursday 04 July 2002 17:23, Wilbert Enserink wrote: > > Hi all, > > > > > > I have to tables A and B. > > They boyh have a column with the same name. > > > > Now, I wrote this MySQL statement performing a left join. > > This results in a data set with rows consisting of 2 columns of the same > > name, in which the date is stored when the record was last altered. This > > column is called "last_altered". > > > > Later on in my script I'm calling the value of this column with php. > > $query="select * from tblA LEFT JOIN ...."; > > $resultID=mysql_query($query); > > while ($result_row=mysql_fetch_array($resultID)) > > { > > echo "$result_row[column with the same name]"; > > } > > > > Well, this works without any php or mysql errors, but it is giving me the > > data back of that column wich I don't wanna have...It returns the > > "last_altered" date of tblB in stead of tblA. A solution might be te > > exclude the second column (the wrong one) from the select statement in the > > query. This is a MySQL adjustement. Anybody knows how this can be done?? > > Try to limit your select statement, instead of SELECT *, use > > SELECT colA, > colB, > tablA.samenamecolA, > tablB.samenamecolA, etc > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > Love is the process of my leading you gently back to yourself. > -- Saint Exupery > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php ------------------------- Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] ------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php