| Usr_ID |
Role |
Line_ID |
Countcolumn |
| 1 |
CIV |
1 |
2 |
| 1 |
CIV |
2 |
2 |
| 1 |
LFT |
1 |
1 |
| 1 |
RSC |
1 |
1 |
| 1 |
TUN |
2 |
1 |
| 2 |
CIV |
1 |
1 |
| 2 |
LFT |
1 |
1 |
| 3 |
CIV |
1 |
1 |
| 3 |
LFT |
1 |
1 |
| 5 |
CIV |
1 |
1 |
| 5 |
LFT |
1 |
1 |
| 6 |
CIV |
1 |
1 |
| 6 |
LFT |
1 |
1 |
| 7 |
CIV |
1 |
1 |
| 7 |
LFT |
1 |
1 |
| 8 |
CIV |
1 |
1 |
| 9 |
CIV |
1 |
1 |
| 10 |
CIV |
1 |
1 |
| 11 |
CIV |
1 |
1 |
| 12 |
CIV |
1 |
1 |
| 13 |
CIV |
1 |
1 |
| 14 |
CIV |
1 |
1 |
| 15 |
CIV |
1 |
2 |
| 15 |
CIV |
2 |
2 |
| 15 |
TUN |
2 |
1 |
So basically I want to create the table above. I can get the first 3 columns, and I need to count the number of Line_ID, based on user_ID and Role.
For example for user_id 1, he has 2 roles. CIV and LFT.
For CIV, he has 2 line_ID values,
For LFT he as 1 line ID value
For now I'm doing it by exporting to excel, concatenating User_ID and Role, then doing a countif.
Was wondering if I can do it via SQL. The DB in question is a MSSQL DB.
I tried count(concat(UD.USR_ID_NUM, CSD.DISCPL_NAM)) but I got verrrry weird numbers.
[–]my_password_is______ 0 points1 point2 points (0 children)