I need to find the doctors revenue from various departments like laboratory,radiology,pharmacy and other departments trough patients.
I have only document_number column where the values recorded as 'L1432','R87j7','P652', etc. if doc_no starts with 'L' then it is laboratory, if doc_no starts with 'R' then it is radiology, if doc_no starts with 'P' then it is pharmacy. How can I do this in SQL?
Output should look like this:
doctor_name laboratory radiology pharmacy others
Michel 23098 6763 78732 98838
John 77838 89898 56542 52654
Cranys 98973 78763 5432 65565