SELECT * FROM DCHN_TEAM_GROUP_RELATION T ;
[img]http://dl.iteye.com/upload/attachment/0080/9569/62ddd362-1217-342f-bfd6-05183bb152ce.jpg[/img]
SELECT T.CITY_NAME,
T.TEAM_NAME,
T.TEAM_ID,
SUM(CASE WHEN TYPE = 1 THEN 1 ELSE 0 END),
SUM(CASE WHEN TYPE = 2 THEN 1 ELSE 0 END )
FROM DCHN_TEAM_GROUP_RELATION T
GROUP BY T.CITY_NAME, T.TEAM_NAME, T.TEAM_ID;
[img]http://dl.iteye.com/upload/attachment/0080/9571/aa93a8f7-212d-3e17-a1be-5fdb9ae418ca.png[/img]