470,874 Members | 1,457 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,874 developers. It's quick & easy.

"not unique table/alias"

I have two complex subqueries that I need to join. I suspect this
problem is due to using aliases instead of table names, but I don't
know how to work around it (temporary tables?). Please help.

SELECT col FROM (subquery-1) AS t1, (subquery-2) AS t2
JOIN t1 ON t2.col = t1.col;
Not unique table/alias: 't1'.
SELECT col FROM (subquery-1) AS t1, (subquery-2) AS t2
WHERE t2.col = t1.col;
Works fine! (But this query is different, because it doesn't get

the rows that are NULL in one of the tables.)

Using MySQL 4.1.1. Thanks in advance for your help.
Jul 20 '05 #1
6 34608
"Jack Tanner" <ih**@hotmail.com> wrote in message
I have two complex subqueries that I need to join. I suspect this
problem is due to using aliases instead of table names, but I don't
know how to work around it (temporary tables?). Please help.

SELECT col FROM (subquery-1) AS t1, (subquery-2) AS t2
JOIN t1 ON t2.col = t1.col;
Not unique table/alias: 't1'.
SELECT col FROM (subquery-1) AS t1, (subquery-2) AS t2
WHERE t2.col = t1.col;
Works fine! (But this query is different, because it doesn't get

the rows that are NULL in one of the tables.)

Using MySQL 4.1.1. Thanks in advance for your help.


Looks like a bug.
Jul 20 '05 #2
"Jack Tanner" <ih**@hotmail.com> wrote in message
I have two complex subqueries that I need to join. I suspect this
problem is due to using aliases instead of table names, but I don't
know how to work around it (temporary tables?). Please help.

SELECT col FROM (subquery-1) AS t1, (subquery-2) AS t2
JOIN t1 ON t2.col = t1.col;
Not unique table/alias: 't1'.
SELECT col FROM (subquery-1) AS t1, (subquery-2) AS t2
WHERE t2.col = t1.col;
Works fine! (But this query is different, because it doesn't get

the rows that are NULL in one of the tables.)

Using MySQL 4.1.1. Thanks in advance for your help.


Looks like a bug.
Jul 20 '05 #3
"Siemel Naran" <Si*********@REMOVE.att.net> wrote in message news:<5T*********************@bgtnsc05-news.ops.worldnet.att.net>...
"Jack Tanner" <ih**@hotmail.com> wrote in message
I have two complex subqueries that I need to join. I suspect this
problem is due to using aliases instead of table names, but I don't
know how to work around it (temporary tables?). Please help.

SELECT col FROM (subquery-1) AS t1, (subquery-2) AS t2
JOIN t1 ON t2.col = t1.col;
>> Not unique table/alias: 't1'.


SELECT col FROM (subquery-1) AS t1, (subquery-2) AS t2
WHERE t2.col = t1.col;
>> Works fine! (But this query is different, because it doesn't get

the rows that are NULL in one of the tables.)

Using MySQL 4.1.1. Thanks in advance for your help.


Looks like a bug.


Could someone from @mysql.com confirm this? Should I be reporting on bugs.mysql.com?
Jul 20 '05 #4
"Siemel Naran" <Si*********@REMOVE.att.net> wrote in message news:<5T*********************@bgtnsc05-news.ops.worldnet.att.net>...
"Jack Tanner" <ih**@hotmail.com> wrote in message
I have two complex subqueries that I need to join. I suspect this
problem is due to using aliases instead of table names, but I don't
know how to work around it (temporary tables?). Please help.

SELECT col FROM (subquery-1) AS t1, (subquery-2) AS t2
JOIN t1 ON t2.col = t1.col;
>> Not unique table/alias: 't1'.


SELECT col FROM (subquery-1) AS t1, (subquery-2) AS t2
WHERE t2.col = t1.col;
>> Works fine! (But this query is different, because it doesn't get

the rows that are NULL in one of the tables.)

Using MySQL 4.1.1. Thanks in advance for your help.


Looks like a bug.


Could someone from @mysql.com confirm this? Should I be reporting on bugs.mysql.com?
Jul 20 '05 #5
Jack Tanner wrote:
Not unique table/alias: 't1'.


I don't know if this helps you, but I have always done it differently.
See the examples:

mysql> select * from t1,t2 left join t1 on t1.id=t2.id;
ERROR 1066: Not unique table/alias: 't1'

mysql> select * from t1 left join t2 on t1.id=t2.id;
+------+------+------+------+
| id | name | id | name |
+------+------+------+------+
| 1 | car | 1 | cat |
| 2 | cube | NULL | NULL |
+------+------+------+------+
2 rows in set (0.00 sec)

# Or if you want to use aliases:
mysql> select * from t1 as k1 left join t2 as k2 on k1.id=k2.id;

I have version 3 of MySQL so can't try with subqueries. And I don't
whether you are supposed to be able to do it the way you tried or not.
Jul 20 '05 #6
Jack Tanner wrote:
Not unique table/alias: 't1'.


I don't know if this helps you, but I have always done it differently.
See the examples:

mysql> select * from t1,t2 left join t1 on t1.id=t2.id;
ERROR 1066: Not unique table/alias: 't1'

mysql> select * from t1 left join t2 on t1.id=t2.id;
+------+------+------+------+
| id | name | id | name |
+------+------+------+------+
| 1 | car | 1 | cat |
| 2 | cube | NULL | NULL |
+------+------+------+------+
2 rows in set (0.00 sec)

# Or if you want to use aliases:
mysql> select * from t1 as k1 left join t2 as k2 on k1.id=k2.id;

I have version 3 of MySQL so can't try with subqueries. And I don't
whether you are supposed to be able to do it the way you tried or not.
Jul 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Rolf Brauser | last post: by
3 posts views Thread by perryclisbee via AccessMonster.com | last post: by
3 posts views Thread by VRSki | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.