SELECT ReciveDate,InType,CustomName,ElNumber=(stuff((select ',' + ElNumber from ElData where IsPrint='N' and CustomName = a.CustomName for xml path('')), 1, 1, '')),sum(Amount) as Amount,ImportDate,IsPrint FROM ElData a where IsPrint='N' group by ReciveDate,InType,CustomName,ImportDate,IsPrint
上面是sql陳述句
聚合前是的內容是
常州
常州
東阿
廣東
濟南
濟南
濟南
江蘇
重慶
重慶
永康
永康
南通
南通
南通
聚合后是的內容是
常州
東阿
廣東
濟南
永康
南通
重慶
重慶
江蘇
重慶跟江蘇莫名其妙就去了后面
uj5u.com熱心網友回復:
group by 多個欄位時,按照欄位先后的順序排序,ReciveDate,InType,CustomName,ImportDate,IsPrintuj5u.com熱心網友回復:
請問這些地名是哪個欄位的值?轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/279115.html
標籤:基礎類
上一篇:作業上對資料庫的操作
