Hello.
Given: table of the form
field1 field2 fieldN
a a ...
a b ...
b a ...
a b ...
a a ...
b b ...

Please tell me how to get a unique combination of two fields and the number of such combinations.Those.the result should be like this
field1 field2 count
a a 2
a b 2
b a 1
b b 1

Thank.

1 Answers 1

group by
select fld1, fld2, count(*) from tblname group_by fld1, fld2