看图有人可以就此提出建议吗?编辑例如,如果其中一个部门没有兼职",这意味着他们的兼职员工数量通常为零. 解决方案 你想要一个 枢轴选择 *来自 (tableb) s枢轴 (Max(staffno) for employee_class in ([Full Time],[Part Time])) pI have two tables.Table A contains a list of departments, there are 20 in total.See imageTable B contains at least 1 row per department found in Table A, with some containing a few.See imageWhat I want is a 3rd table created from A & B which basically lists every department and then the number of people who are full time and part time. If for example there is a department found in table b which only has a figure for either Full or Part time (an example of this is department D) then I want the table to display 0 (zero) instead of leaving this blank.See imageCan anyone advise on this?EDITIf there is no for example 'Part time' for one of the Departments, that means that their part time staff count WILL be zero as a rule. 解决方案 You want a PIVOTselect *from (tableb) spivot (Max(staffno) for employee_class in ([Full Time],[Part Time])) p 这篇关于操作结果以将行显示为列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-27 15:24
查看更多