I'm trying to build a T-SQL query to list some columns and group values with certain criteria under a different name.
This is what I have in my table:
Category | Verdict | Requests
-----------|--------------|----------
Category1 | Allowed | 1000
Category2 | denied_now | 100
Category2 | denied_later | 101
Category3 | Allowed | 203
I wanted to end up with a result like this.
Category | Verdict | Requests
-----------|--------------|----------
Category1 | Allowed | 1000
Category2 | denied_all | 201
Category3 | Allowed | 203
I tried a SELECT
combined with GROUP BY
and HAVING
but I always get an error. How to combine those values into a new row under a new name for Verdict = denied% ?