當我運行採購訂單的報告時,報告會複製產品代碼的記錄。SSRS 2005報告重複的記錄
例如,採購訂單是:P000976,報告應該只顯示一次時顯示產品代碼兩次。 45-5540出現兩次。
P000976 2012年9月17日15,040.00 15,040.00 0.00
45-5540 「脊柱前凸頸椎間隔10毫米 脊柱前凸頸椎間隔10毫米」 20 20 0
45-5540 「脊柱前凸頸椎間隔10毫米 脊柱前凸頸椎間隔10毫米」 20 20 0
當我把報告的SQL在SQL服務器並通過查看運行SQL其中代碼會導致額外的產品代碼,這是此行的SQL內:
加入上q.distpartno = p all_product_codes_VW頁。 distpartno
select q.specialrequirement
, q.distpartno
, q.toproduce
, q.prodbegindate
, q.distributor
, rc.report_category_name
, s.productperpo
, r.ebi_released
, w.ebi_in_WIP
, p.distproductname
, tp.typeprefixdetail
, tp.cost
, '1' as ReportTotals
from all_required_vw q
left join all_shipped_grafts_new_VW s on (q.distpartno = s.distpartno and q.specialrequirement = s.ponumber)
left join all_released_Grafts_VW r on q.distpartno = r.distpartno
left join all_in_WIP_VW w on q.distpartno = w.distpartno
join all_product_codes_VW p on q.distpartno = p.distpartno
join setup_tissue_prefix tp on q.typenumber = tp.typeprefix
join setup_report_category_1 rc on q.distributor = rc.report_category_id
where q.prodbegindate < @enddate
and q.completed = '0'
and rc.report_category_name like '%' + isnull(@tcustomer, '') + '%'
order by q.prodbegindate, p.distproductname
這是連接創建副本的視圖的SQL。
SELECT COUNT_BIG(*) AS BIG, DistPartNo, DistProductName, Distributor, UMTBProductCode
FROM dbo.Setup_Distributor_Product_info
WHERE (Distributor <> '7') OR (Distributor IS NULL)
GROUP BY DistPartNo, DistProductName, Distributor, USSAProductCode