SQL Question

Поиск
Список
Период
Сортировка
От Ketema Harris
Тема SQL Question
Дата
Msg-id 983b67500602081143j3697b693s29ce5fc929e59fc0@mail.gmail.com
обсуждение исходный текст
Ответы Re: SQL Question  (Jeffrey Melloy <jmelloy@visualdistortion.org>)
SQL Query gone wrong.. please help  (Srinivas Iyyer <srini_iyyer_bio@yahoo.com>)
Список pgsql-novice
Hey guys I have a SQL teaser I could use a little assistance with.
 
Imagine a table like below:
 
rowid|typeid|personid
---------------------------
1                3            1
2                3            1
3                1            2
4                1            1
5                3            2
 
my desired output is:
 
person|# of rows of type 3|# of total rows|% of type 3
----------------------------------------------------------------
1                            2                                    3                        66.7
2                            1                                    2                        50
 
how can I achieve this output with one single query?  sub selects are fine.
 
Thanks

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

Предыдущее
От: Noel Faux
Дата:
Сообщение: data corruption how zero bad page blocks etc
Следующее
От: André de Camargo Fernandes
Дата:
Сообщение: How to control memory usage of postgresql