Multiple-table select & same field names

wxdqz

New Member
Hey all -

When I do a select across more than one table, at least two of which have some fields that are named the same thing, can I tell which table each field in the result set came from? In other words, if I do:

select table1.*, table2.* from table1, table2 where table1.name = table2.name;

And each table has name, address, city, and state... If I do

$myVar = mysql_fetch_array($query_result);

then $myVar["city"] will equal the city from table1 or the city from table2, but not both. Is there a way to fully qualify the field names, or do I just have to prepend the fields with the table name in MySQL or something to make them distinct?

Uh, sorry if that was drawn out and confusing...

Thanks,

Jeremy
 
Back
Top