Data:
QID Type DOB
-------------
1 1 01/01/1980
1 2 03/01/1981
1 2 01/02/1991
1 1 01/01/1980
1 2 03/01/1981
1 3 01/02/1991
1 1 01/01/1980
2 2 03/01/1981
2 2 01/02/1991
2 1 01/01/1980
2 2 03/01/1981
2 2 01/02/1991
I need to select query that get this result:
QID Type(1) Type(2) Type(3)
----------------------------
1 3 3 1
2 1 4 0
I should use Function or can embedded in select query?