搜索结果的countt包含了门诊和住院的数量,countt是可变的;怎么把上图转换成下图的样子呢??
收起
SELECT Referral_Report_Employee_No, isnull(住院,0) 住院Count, isnull(门诊,0) 门诊Count FROM YourTable PIVOT ( count(countt) FOR Referral_Type IN ([住院], [门诊]) ) [pivottable]
报告相同问题?