"UNION ALL" is failing

Поиск
Список
Период
Сортировка
От Joy Smith
Тема "UNION ALL" is failing
Дата
Msg-id CAJqhhiPsxUroD23ea1iADkTovmsoOOMrsMGBKgh-nwAYsXd3bQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: "UNION ALL" is failing  (Guillaume Lelarge <guillaume@lelarge.info>)
Re: "UNION ALL" is failing  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: "UNION ALL" is failing  (Darren Duncan <darren@darrenduncan.net>)
Список pgsql-general
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 at or near "UNION"
SQL state: 42601
Character: 278


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Here is the query:

with a as
(
select channel,node,accesses from storage where monthly = '11-06'
),
b as
(
select channel,node,accesses from storage where monthly = '11-07'
)

select
b.node
from a right join b on a.node=b.node
where a.accesses is null and b.channel = ('611 IVR')
order by node


UNION ALL


with a as
(
select channel,node,accesses from storage where monthly = '11-06'
),
b as
(
select channel,node,accesses from storage where monthly = '11-07'
)


select
b.node 
from a right join b on a.node=b.node
where a.accesses is null and b.channel = 'olam'
order by node


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
here is the table structure:

-- Table: "storage"

-- DROP TABLE "storage";

CREATE TABLE "storage"
(
  node character varying,
  accesses double precision,
  monthly character varying,
  model character varying,
  channel character varying,
  qualified character varying,
  bigintmark bigserial NOT NULL,
  insertiondate timestamp with time zone NOT NULL DEFAULT now(),
  CONSTRAINT aso PRIMARY KEY (bigintmark)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE "storage" OWNER TO postgres;

В списке pgsql-general по дате отправления:

Предыдущее
От: Devrim GÜNDÜZ
Дата:
Сообщение: Re: Postgresql 9.0.4 SRPMS
Следующее
От: Guillaume Lelarge
Дата:
Сообщение: Re: "UNION ALL" is failing