* Wilbert Enserink 
> 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.
> 
> Anybody knows how this can be done?? Or are there other solutions?

You can use column aliases:

SELECT *,
  tblA.last_alter AS last_alter_A,
  tblB.last_alter AS last_alter_B,
FROM tblA 
LEFT JOIN ...

-- 
Roger

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to