Search Postgresql Archives

Re: correlated query as a column and where clause

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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_'


what you are looking for is the having clause

Select nspname, count(1)Â
ÂFROM pg_tablesÂ
where nspname !~* 'pg_'Â
group by nspname
havingÂcount(1) Â>10

best wishes

Harald

--
Harald Armin Massa  ÂÂwww.2ndQuadrant.com
PostgreSQL ÂTraining, Services Âand Support

2ndQuadrant Deutschland GmbH Â Â
GF: Harald Armin Massa
Amtsgericht Stuttgart, HRB 736399


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux