I cant for the life of me figure out why this is erroring
A:
It means exactly what it says - each derived table must have an alias. SELECT a.* FROM (SELECT ....)a
Update. This should work for you:
SELECT xxx.* FROM
(
SELECT ....
FROM ....
UNION
(
SELECT ....
FROM .....
LIMIT 46
)
LIMIT 50
)xxx
a1ex07
2010-07-29 15:05:13
I am not sure what you mean...i tried to add it there are but now i get ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as a limit 0,50)' at line 144
Matt
2010-07-29 15:09:22
Sorry, I didn't notice that one of your table has already had alias a.Use a different alias - `SELECT xxxx.* FROM (SELECT ....)xxxx`
a1ex07
2010-07-29 15:13:34
And when you use alias for `SELECT ... FROM t1 JOIN t2 JOIN t3...` you should also enclose SELECT into brackets (`(SELECT ... FROM t1 JOIN t2 JOIN t3 ...) [AS] a`). It why it complaints on near 'as a limit 0,50)' at line 144"
a1ex07
2010-07-29 15:19:23
A:
The very first line of your query is
SELECT * FROM
which appears to be unnecessary (as all three UNIONed queries already include SELECT and FROM clauses).
Removing this unnecessary line should resolve the problem; alternatively, adding a (
just after the first line, and adding a ) QRYALIAS
at the end would also resolve the problem.
Mark Bannister
2010-07-29 15:42:55