Fixed the query adding doctor permissions SHOULD be good now.