List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:August 27 2001 5:57pm
Subject:Re: Selecting * from multiple tables
View as plain text  
At 10:43 AM -0700 8/27/01, Dave Mittner wrote:
>I'm running into a snag... here's an example of the query I'm making
>from within Perl:
>SELECT * FROM table1,table2
>I know it's not a nice way to do it, but I'm making an SQL webpage
>frontend which I'd like to support it just in case. I'm
>using fetchrow->hashref to pull it out and display it. The problem I'm
>running into is when table1 and table2 have similar
>column names. One of them would be overwritten in the hash reference to
>be replaced by the second one it encounters.
>So my question is this. Is there any way to force MySQL to ouput the
>table name with the column name instead of just the
>column name, ie. table1.column2.

No.  Name the columns explicitly and give them aliases.

>Thanks in advance,
>Dave Mittner

Paul DuBois, paul@stripped
Selecting * from multiple tablesDave Mittner27 Aug
  • Re: Selecting * from multiple tablesPaul DuBois27 Aug
  • Re: Selecting * from multiple tablesIan Barwick27 Aug