SELECT PL_SITE.SITE_NAME,PL_AREA.AREA_NAME,PL_CELL.CELL_NAME,WORK_ORDER_ITEM.PLANNED_QTY, APP_ROLE.APP_ROLE_NAME,APP_ROLE.APP_ROLE_NUMBER,COUNT(APP_USER.APP_USER_NUMBER) AS TOTAL FROM dbo.[PL_SITE] LEFT JOIN PL_AREA ON PL_SITE.OBJECT_KEY = PL_AREA.SITE_KEY LEFT JOIN PL_CELL ON PL_AREA.OBJECT_KEY = PL_CELL.AREA_KEY LEFT JOIN WORK_ORDER_ITEM ON PL_CELL.OBJECT_KEY = WORK_ORDER_ITEM.PL_CELL LEFT JOIN APP_ROLE ON WORK_ORDER_ITEM.APP_ROLE = APP_ROLE.OBJECT_KEY LEFT JOIN T_USER_ROLE ON APP_ROLE.OBJECT_KEY = T_USER_ROLE.USERGROUPENTITY_ID LEFT JOIN APP_USER ON T_USER_ROLE.USERENTITY_ID = APP_USER.OBJECT_KEY 我想数出每条产线(PL_CELL.CELL_NAME)里面包含几个用户 (APP_USER.APP_USER_NUMBER),应该怎么改? |