Re: Percentage of Total Occurances

Поиск
Список
Период
Сортировка
От
Тема Re: Percentage of Total Occurances
Дата
Msg-id 1177.219.65.253.230.1050426637.squirrel@mail.trade-india.com
обсуждение исходный текст
Ответ на Percentage of Total Occurances  (Adam Sherman <adam@tritus.ca>)
Ответы Re: Percentage of Total Occurances  (Adam Sherman <adam@tritus.ca>)
Список pgsql-sql
> I have a table being used for poll results:
>
> id
> poll_id
> question_id
> answer_id
> datestamp
>
> I what to figure out the percentage or respondants that gave each answer.  This is based on
> occurance rather than values.

select answer_id,count(*) from polls where poll_id = ?
group by answer_id ;

gives number of response of each answer

total_response = select count(*) from polls where poll_id = ?

getting %age shud be trivial.

Dunno if i missed your question .
>
> I want to be able to figure it out for a single (poll_id,qustion_id)  combination and also for
> multiple questions.
>

sorry i do not get it.

> Thanks for your help,
>
> A.
>
>
> --
> Adam Sherman
> Tritus CG Inc.
> http://www.tritus.ca/
> +1 (613) 797-6819
>
>
> ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9'
> the postmaster



-----------------------------------------
Get your free web based email at trade-india.com.  "India's Leading B2B eMarketplace.!"
http://www.trade-india.com/



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

Предыдущее
От: "Pedro Igor Craveiro e Silva"
Дата:
Сообщение: accent problems
Следующее
От: "Zodiac"
Дата:
Сообщение: plpgsql