Re: Cross-classified table
От | Bruno LEVEQUE |
---|---|
Тема | Re: Cross-classified table |
Дата | |
Msg-id | 3F943D25.80206@net6d.com обсуждение исходный текст |
Ответ на | Cross-classified table (Alexander Pucher <pucher@atlas.gis.univie.ac.at>) |
Список | pgsql-novice |
The query : select origin, sex, count(sex) from table group by origin, sex; gives the result : origin | sex | count --------+--------+------- China | male | 2 UK | male | 1 USA | female | 1 USA | male | 2 (4 rows) Is it enought ? Bruno Alexander Pucher wrote: > Hi, > I'm looking for the correct syntax of getting a cross-classified table > from my SELECT statement. > > Let's pretend I have this table: > > > origin sex > ---------------- > USA male USA female > China male > China male > UK male > USA male > > > and I want as result something like: > > male female > > USA 2 1 China 2 0 > UK 1 0 > > > How can I get this? > > Best regards, > alex > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > -- Bruno LEVEQUE System Engineer SARL NET6D bruno.leveque@net6d.com http://www.net6d.com
В списке pgsql-novice по дате отправления: