"Steven O'Toole" <steven(at)o2l(dot)com> writes:
> Is there any way to do this kind of query in PGSQL?
> SELECT count0, count1 FROM (
> SELECT COUNT(*) AS count0
> FROM measurement
> WHERE responseTime = 0
> GROUP BY responseTime
> ), (
> SELECT COUNT(*) AS count1
> FROM measurement
> WHERE responseTime = 1
> GROUP BY responseTime
> )
> ;
PG 7.1 supports this ... but note it requires you to adhere to the
letter of the SQL spec: you must provide an alias table name for
each sub-select-in-FROM:
SELECT ... FROM (SELECT ...) AS foo, ...
The AS word is optional, but the alias "foo" is not.
regards, tom lane