Re: correlated query as a column and where clause

Поиск
Список
Период
Сортировка
От Chris Curvey
Тема Re: correlated query as a column and where clause
Дата
Msg-id BANLkTi=xPxYwbuVVHeNwVL+FT3OOxXzJDQ@mail.gmail.com
обсуждение исходный текст
Ответ на correlated query as a column and where clause  (salah jubeh <s_jubeh@yahoo.com>)
Ответы Re: correlated query as a column and where clause
Список pgsql-general

On Fri, Apr 15, 2011 at 11:22 AM, salah jubeh <s_jubeh@yahoo.com> wrote:
Hello All,

I am wondering,  why I can not add the following  '  A > 10'  in the where  clause  i.e.   'where nspname !~* 'pg_'  and A > 10'

Select nspname, (SELECT count(*) as count FROM pg_tables where schemaname = nspname) as A
FROM pg_namespace
where nspname !~* 'pg_'

I can't answer your question directly, but I would rewrite the query as:

select pg_namespace.nspname, count(*)
from pg_namespace
join pg_tables on pg_namespace.nspname = pg_tables.schemaname
where pg_namespace.nspname not like 'pg_%'
group by pg_namespace.nspname
having count(*) > 10




Thanks in advance





--
Ignoring that little voice in my head since 1966!

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

Предыдущее
От: Harald Armin Massa
Дата:
Сообщение: Re: correlated query as a column and where clause
Следующее
От: salah jubeh
Дата:
Сообщение: Re: correlated query as a column and where clause