에 여러 개의 행을 집계하는 방법은 몇 일 전 similar question을 요청하지만, 더 도전 한 포즈에 전혀 해가 없습니다. 긴 이야기를 짧게하기 위해 SQL Server에서 데이터 세트를 다시 가져 오는 중이고이를 보고서에서 올바르게 그룹화하는 방법을 알지 못합니다.하나
SELECT companyID = 106, userID = 71152, productID = 11,taxID = 216, quantity = 78, total = 71325 UNION ALL
SELECT companyID = 106, userID = 71152, productID = 11,taxID = 245, quantity = 41, total = 40297 UNION ALL
SELECT companyID = 106, userID = 71152, productID = 12,taxID = 246, quantity = 12, total = 7685 UNION ALL
SELECT companyID = 106, userID = 51154, productID = 11,taxID = 216, quantity = 92, total = 84311 UNION ALL
SELECT companyID = 106, userID = 51154, productID = 11,taxID = 245, quantity = 145, total = 139329 UNION ALL
SELECT companyID = 106, userID = 51154, productID = 11,taxID = 275, quantity = 80, total = 87513 UNION ALL
SELECT companyID = 106, userID = 51154, productID = 12,taxID = 246, quantity = 23, total = 15800 UNION ALL
SELECT companyID = 106, userID = 51154, productID = 12,taxID = 277, quantity = 12, total = 8060 UNION ALL
SELECT companyID = 106, userID = 51221, productID = 11,taxID = 216, quantity = 4, total = 3655 UNION ALL
SELECT companyID = 106, userID = 51221, productID = 11,taxID = 245, quantity = 29, total = 29692 UNION ALL
SELECT companyID = 106, userID = 51221, productID = 11,taxID = 275, quantity = 55, total = 63679 UNION ALL
SELECT companyID = 106, userID = 51221, productID = 12,taxID = 246, quantity = 3, total = 2390 UNION ALL
SELECT companyID = 106, userID = 61221, productID = 11,taxID = 216, quantity = 162, total = 138403 UNION ALL
SELECT companyID = 106, userID = 61221, productID = 11,taxID = 245, quantity = 130, total = 123760 UNION ALL
SELECT companyID = 106, userID = 61221, productID = 11,taxID = 275, quantity = 19, total = 22073 UNION ALL
SELECT companyID = 106, userID = 61221, productID = 12,taxID = 246, quantity = 1, total = 415 UNION ALL
SELECT companyID = 114, userID = 71198, productID = 11,taxID = 245, quantity = 131, total = 134039 UNION ALL
SELECT companyID = 114, userID = 71198, productID = 11,taxID = 275, quantity = 120, total = 141423 UNION ALL
SELECT companyID = 114, userID = 71198, productID = 12,taxID = 246, quantity = 70, total = 36590 UNION ALL
SELECT companyID = 114, userID = 71198, productID = 12,taxID = 249, quantity = 1, total = 980 UNION ALL
SELECT companyID = 114, userID = 71198, productID = 12,taxID = 276, quantity = 1, total = 790 UNION ALL
SELECT companyID = 114, userID = 71198, productID = 12,taxID = 277, quantity = 64, total = 41380 UNION ALL
SELECT companyID = 114, userID = 71198, productID = 12,taxID = 279, quantity = 1, total = 690 UNION ALL
SELECT companyID = 114, userID = 71198, productID = 12,taxID = 293, quantity = 1, total = 760 UNION ALL
SELECT companyID = 114, userID = 71204, productID = 11,taxID = 245, quantity = 48, total = 48049 UNION ALL
SELECT companyID = 114, userID = 71204, productID = 11,taxID = 275, quantity = 41, total = 43729 UNION ALL
SELECT companyID = 114, userID = 71204, productID = 12,taxID = 246, quantity = 1, total = 450 UNION ALL
SELECT companyID = 114, userID = 71204, productID = 12,taxID = 249, quantity = 7, total = 5895 UNION ALL
SELECT companyID = 114, userID = 71204, productID = 12,taxID = 277, quantity = 2, total = 1300 UNION ALL
SELECT companyID = 114, userID = 71204, productID = 12,taxID = 279, quantity = 2, total = 2230 UNION ALL
SELECT companyID = 614, userID = 71198, productID = 11,taxID = 216, quantity = 54, total = 48748 UNION ALL
SELECT companyID = 614, userID = 71198, productID = 11,taxID = 245, quantity = 121, total = 113030 UNION ALL
SELECT companyID = 614, userID = 71198, productID = 12,taxID = 246, quantity = 11, total = 6080 UNION ALL
SELECT companyID = 614, userID = 71204, productID = 11,taxID = 216, quantity = 14, total = 11519 UNION ALL
SELECT companyID = 614, userID = 71204, productID = 11,taxID = 245, quantity = 32, total = 29103 UNION ALL
SELECT companyID = 614, userID = 71204, productID = 12,taxID = 249, quantity = 3, total = 3535
는 기본적으로, 우리는 서로 다른 세율에 특정 제품을 판매 :
는 여기에 몇 가지 샘플 데이터입니다.
companyID userID productID sumQuantity sumTotal
----------- ----------- ----------- ----------- -----------
106 51154 11 317 311153
106 51154 12 35 23860
106 51221 11 88 97026
106 51221 12 3 2390
106 61221 11 311 284236
106 61221 12 1 415
106 71152 11 119 111622
106 71152 12 12 7685
114 71198 11 251 275462
114 71198 12 138 81190
114 71204 11 89 91778
114 71204 12 12 9875
614 71198 11 175 161778
614 71198 12 11 6080
614 71204 11 46 40622
614 71204 12 3 3535
SSRS taxID 때문에이 방법으로 행 그룹에없는 :이 유사 회사 ID, 사용자 ID, 제품 ID에 의해 그룹의 데이터와는 수량과 총 필드의 합을 표시 데이터를 표시 할 고유합니다. 결과는 these screenshots에서 볼 수 있습니다.
내가 한 행에 여러 레코드를 통합 SSRS를 강제로 어떻게?
나는 3 개의 downvotes를 이해하지 못한다. 나에게 합리적인 질문처럼 보입니다. –
@unforgiven : 질문에 대한 좋은 편집 내용을 오류가있는 거대한 쓸데없는 텍스트 배경으로 롤백하는 것은 항상 downvotes를 얻는 좋은 방법입니다. – GEOCHET
리치 : 내 오류, 원하는 솔루션 및 실험 할 샘플 데이터에 대한 설명을 제공하는 데 문제가 없습니다. 그것이 마지막 편집에서 의도적으로 엉망이 된 후에 나의 포스트는 그것의 downvotes를 받았다. 진지하게 왜 금지 당하지 않았 니? – Juliet