Fixed missing scale and removed redundant join in query