I will have you served for a violation of federal law if you do not remove
immediately!!
----- Original Message -----
From: Jeremy Zawodny <[EMAIL PROTECTED]>
To: Philip Mak <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, September 07, 2001 10:48 PM
Subject: Re: Perl DBI: Same column name in different tables problem


> On Fri, Sep 07, 2001 at 10:03:03PM -0700, Philip Mak wrote:
> > Let's say I performed the following query using Perl DBI:
> >
> > $row = $dbh->selectrow_hashref(<<"~");
> > SELECT fanfics.handle, authors.handle
> > FROM fanfics, authors
> > WHERE fanfics.aid = authors.aid
> > ~
> >
> > I won't be able to access both fanfics.handle and authors.handle
> > this way, because they're called "handle". I would like to be able
> > to access them e.g. by doing $row->{fanfics.handle} and
> > $row->{authors.handle}, or something like that.
> >
> > What workarounds have people found for this problem?
>
> Use a column alias:
>
>   SELECT fanfics.handle as f_handle, authors.handle as a_handle
>     FROM fanfics, authors
>    WHERE fanfics.aid = authors.aid
>
> Then refer to them as $row->{a_handle} or $row->{f_handle}.
>
> Jeremy
> --
> Jeremy D. Zawodny, <[EMAIL PROTECTED]>
> Technical Yahoo - Yahoo Finance
> Desk: (408) 349-7878   Fax: (408) 349-5454   Cell: (408) 685-5936
>
> MySQL 3.23.41-max: up 2 days, processed 42,300,526 queries (237/sec. avg)
>
> ---------------------------------------------------------------------
> 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
>


---------------------------------------------------------------------
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