MySQL Forums
Forum List  »  New in 4.1: Subqueries

FROM ( (query) UNION (UNION) ) AS tbl
Posted by: roditi.g
Date: May 25, 2005 11:34AM

I AM trying to do the following and I am getting a
#1248 - Every derived table must have its own alias
error. any ideas?


SELECT id, SUM (f2), SUM(AA), SUM(BB) FROM
(
(SELECT id, f2,
'1' AS AA,
'0' AS BB
FROM db1.t2
)
UNION
(
SELECT id, f2,
'0' AS AA,
'1' AS BB
FROM db2.t2
)
) AS my_sub_table
GROUP BY id

Options: ReplyQuote


Subject
Views
Written By
Posted
FROM ( (query) UNION (UNION) ) AS tbl
5932
May 25, 2005 11:34AM
Re:
3253
May 25, 2005 11:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.