List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 13 1999 1:50am
Subject:Re: Join help...
View as plain text  
At 7:33 PM -0500 9/12/99, Robert Covell wrote:
>Could someone help me make the join(left I believe is what I need) for the
>following two tables.
>
>Desired Result: A list of all the pageAlias's and the count for today
>even if it (the count) doesn't exist.  In the code I would check (count)
>and if it was null (what a left join adds if the row is not there) display
>0;
>
>This is what I have now and I get ERROR 1066: Not unique table/alias:
>'pageDayHitLog1':
>
>select pageList1.pid, pageList1.pageAlias from pageDayHitLog1 LEFT JOIN
>pageDayHitLog1 ON pageList1.pid=pageDayHitLog1.pid where
>YEAR(pageDayHitLog1.hitDate)=YEAR(NOW()) AND
>MONTH(pageDayHitLog1.hitDate)=MONTH(NOW()) AND
>DAYOFMONTH(pageDayHitLog1.hitDate)=DAYOFMONTH(NOW()) and
>pageList1.pid=pageDayHitLog1.pid;


You have "from tbl_name LEFT JOIN tbl_name" with the same table name
on both sides of the LEFT JOIN.  I suppose you really want the
first pageDayHitLog1 to be pageList1, at least that's what I'd guess
from the rest of the query.

The error message means you have ambiguous table references in the
table list - since you name the same table twice without giving
one of them an alias, the server can't tell what to do.

--
Paul DuBois, paul@stripped
Thread
Join help...Robert Covell13 Sep
  • Re: Join help...Paul DuBois13 Sep