Re: combining two queries?

Поиск
Список
Период
Сортировка
От Eddy Macnaghten
Тема Re: combining two queries?
Дата
Msg-id 1098541120.30770.11.camel@localhost.localdomain
обсуждение исходный текст
Ответ на combining two queries?  (Mark Harrison <mh@pixar.com>)
Ответы Re: combining two queries?  (Jeffrey Melloy <jmelloy@visualdistortion.org>)
Список pgsql-general
select b.name as viewer, count(*)
from viewer_movies a, xenons b
where b.id = a.viewerid
group by b.name


On Sat, 2004-10-23 at 00:55, Mark Harrison wrote:
> How can I combine these two queries?
>
> # select viewerid,count(*) from viewer_movies group by viewerid order by viewerid;
>   viewerid  | count
> ----------+--------
>   22964835 |   3055
>   22964836 |   1291
>   22964837 |   3105
>   22964838 |    199
>
>
> planb=# select name from xenons where id = 23500637;
>    name
> ---------
>   x.moray
>
> I would like to end up with a query result like this:
>
>   viewer   | count
> ----------+--------
>   x.surf   |   3055
>   x.dream  |   1291
>   x.moray  |   3105
>   x.sleepy |    199
>
> Many TIA!
> Mark
--
Edward A. Macnaghten
http://www.edlsystems.com


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

Предыдущее
От: Philip Hofstetter
Дата:
Сообщение: Bug or stupidity
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Bug or stupidity