?
Solved

not unique table alias error

Posted on 2005-05-12
1
Medium Priority
?
651 Views
Last Modified: 2008-03-10
Anyone know what would be causing this 'not unique table/alias' error?

ODBC Error Code = S1000 (General error)

[MySQL][ODBC 3.51 Driver][mysqld-4.0.24-nt]Not unique table/alias: 'articles'

SQL = "SELECT Category.acatid, Category.acategory, articles.writerid, articles.articleid, articles.articledate, articles.summary, articles.title, articles.words, articles.atype, articles.payonly, articles.requests, writers.fname, writers.lname FROM articles, writeres, Category INNER JOIN (writers INNER JOIN articles ON writers.writerid = articles.writerid) ON Category.acatid = articles.acatid WHERE articles.words>-1 AND category.acategory Like 'Business%' AND articles.articledate>Now()-8 ORDER BY articles.requests DESC, articles.articledate DESC"


Thanks,
Rick
0
Comment
Question by:bluskyGuy
1 Comment
 
LVL 5

Accepted Solution

by:
ljw87505 earned 2000 total points
ID: 13992770
Hi Rick,

It appears that you reference the table "articles" twice.  You need to alias one of them to avoid ambiguity.  

SELECT ...
FROM *articles*, writeres, Category
INNER JOIN (writers INNER JOIN *articles* ON writers.writerid = articles.writerid) ON Category.acatid = articles.acatid
WHERE ...

I'm a little confused by the syntax after the INNER JOIN clause...should it really be something like

SELECT ...
FROM articles, writeres, Category
INNER JOIN (SELECT * FROM writers INNER JOIN articles ON writers.writerid = articles.writerid) x ON Category.acatid = x.acatid
WHERE ...

?
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question