The whole point of "with" is to factor out redundancy, and yet here you are
going and repeating the 2 "with" declarations; also the declarations have the
same names, which would be a problem, besides being redundant.
Try it like this instead:
with ...
(select ...)
union all
(select ...)
order
Hello Guillaume, thanks your and Tom's solutions worked.
I did find the page you cited though I admit when I was reading through all
the bracets i was not sure if it was telling me a precedence, order or what.
I am sure as i get better the following will read quite clearly.
[ WITH [ RECURSIVE ]
Thanks for the suggestions,
combining your and Guillaume Lelarge suggestions
I was able to get it two work.
I had to do two things.
1. take away the with's and just drop them into my from statement
2. remove the order by's
so the working sql is as follows:
select
'Phone 611 IVR',
'New States
Joy Smith writes:
> column types are the same so I don't know why this 'union all' is failing.
It's a syntax error --- got nothing to do with column types.
I think what you need to do is parenthesize the first subquery. ORDER
BY isn't allowed to be attached to a UNION subquery otherwise. You'r
On Fri, 2011-08-26 at 09:28 -0400, Joy Smith wrote:
> column types are the same so I don't know why this 'union all' is failing.
> Any ideas?
>
You cannot have an ORDER BY before the UNION ALL. The manual says:
[ WITH [ RECURSIVE ] with_query [, ...] ]
SELECT [ ALL | DISTINCT [ ON ( expression
column types are the same so I don't know why this 'union all' is failing.
Any ideas?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
here is the error:
ERROR: syntax error at or near "UNION"
LINE 17: UNION ALL
^
** Error **
ERROR: syntax error a