Our system has a table called ledger
services can have up to 12 additional descriptor codes these are stored as 12 fields in the same table marked dx1, dx2, dx3 etc
I have worked up a script with the basic essence of what I am trying to get for a single column
I tried using UNION but that lead to issues getting the countSELECT dx1, count(dx1) FROM Ledger group by dx1
however I need to include the values from the other columns so I get a single list with total time each code is used across all 12 columns
(I will also be adding a date range after this on the procedure date column but just trying to get the basics in first).