Yak Posting Veteran
Posted - 07/25/2013 : 15:29:34
I have a query that is looking at invoices that are discrepant. It requires that I count the discrepant info by discrepant code and in an SSRS report display the code and the discrepant number. Then clicking on a code would show the detail of the invoices that are discrepant.
The problem is that when I count the discrepant codes it comes up with 11 for example, but when I look at the data there are 13 rows of data.
Does anyone have an idea on why I might have my counts off?
Here is my sql:
create table #DISCRInfo (
insert into #DISCRInfo
where INV_LINE_DISCR.REVIEW_DATE >= '07/01/2013' and
INV_LINE_DISCR.REVIEW_DATE <= '07/05/2013' and
INV_DISCR_RES_CD is not null
group by INV_LINE_DISCR.INV_DISCR_CD
order by INV_LINE_DISCR.INV_DISCR_CD
CAST (#DISCRInfo.DISCRCount AS VARCHAR(10)) + '-' + INV_LINE_DISCR.INV_DISCR_CD AS DISCR_CODE,
CODE_TABLE.NAME AS CODE_DESCR,
USR.NAME AS AP_TECH,
SUB_ACCT.NAME as BUDGET,
MFR.NAME AS SUPPLIER,
ON INV.INV_ID = INV_LINE.INV_ID
ON INV_LINE_DISCR.INV_LINE_ID = INV_LINE.INV_LINE_ID
on INV.PO_NO = PO.PO_NO
on USR.USR_ID = INV.APPR_USR_ID
on CODE_TABLE.TYPE_CD = INV_LINE_DISCR.INV_DISCR_CD
on SUB_ACCT.SUB_ACCT_ID = INV_LINE.SUB_ACCT_ID
Thanks for any suggestions.
Renton, WA USA