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