Scope of Alias for Subquery in FROM-Clause
387900Feb 17 2003 — edited Feb 18 2003Hi guys,
I need an SQL construct like this
SELECT ...
FROM x, (subquery) alias
WHERE ...
UNION ALL
SELECT ...
FROM y, (subquery) alias
WHERE ...
UNION ALL
SELECT ...
FROM z, (subquery) alias
WHERE ...
The FROM-Subquery is always the same and it is pretty complex, so I would prefer to define it only once and use only the alias afterwards, like this:
SELECT ...
FROM x, (subquery) alias
WHERE ...
UNION ALL
SELECT ...
FROM y, alias
WHERE ...
UNION ALL
SELECT ...
FROM z, alias
WHERE ...
This results in an error. Any hints?
Thanks,
Akos