I'm trying to work out if it's possible to do the following transformation in SQL:
+--------+--------+--------+
|POLICY_1|POLICY_2|POLICY_3|
+--------+--------+--------+
|T |T |F |
+--------+--------+--------+
|F |T |F |
+--------+--------+--------+
|T |T |T |
+--------+--------+--------+
Is it possible to query this table and end up with a result set that looks like:
+------+-----+
|POLICY|COUNT|
+------+-----+
|1 |2 |
+------+-----+
|2 |3 |
+------+-----+
|3 |1 |
+------+-----+
I'm wondering in general SQL terms, but incase it matters I'm using Postgres (9.2)