I have the following table tableA
in PostgreSQL:
+-------------+-------------------------+
| OperationId | Error |
+-------------+-------------------------+
| 1 | MajorCategoryX:DetailsP |
| 2 | MajorCategoryX:DetailsQ |
| 3 | MajorCategoryY:DetailsR |
+-------------+-------------------------+
How do I group the MajorErrorCategory such that I get the following?
+----------------+------------+
| Category | ErrorCount |
+----------------+------------+
| MajorCategoryX | 2 |
| MajorCategoryY | 1 |
+----------------+------------+
Category
is the first part of Error
after splitting on ':'.