The client wrote down this for me to query from the database. I don't understand the With max dib_mvt_seq_num
Count cossn, with max dib_mvt_seq_num where DIB_MVT_TYP = 'R', ORG_ID not ='R%' or 'S%' or 'V%' or 'P%' and where completedt is null for that cossn in table claims
Here's my attempt of it:
select t.doc, count(t.clmssn) as PendInFO, max(dib_mvt_seq_num) as MaxSeq
From t2DibPend AS t
where(DIB_MVT_TYP='r') and not (org_id like 'R%' or org_id like 'S%' or org_id like 'V%' or
org_id like 'P%') and t.clmssn not in (select cossn from seb2a21.specnew.dbo.claims where completedt is null)
group by t.doc
Count cossn, with max dib_mvt_seq_num where DIB_MVT_TYP = 'R', ORG_ID not ='R%' or 'S%' or 'V%' or 'P%' and where completedt is null for that cossn in table claims
Here's my attempt of it:
select t.doc, count(t.clmssn) as PendInFO, max(dib_mvt_seq_num) as MaxSeq
From t2DibPend AS t
where(DIB_MVT_TYP='r') and not (org_id like 'R%' or org_id like 'S%' or org_id like 'V%' or
org_id like 'P%') and t.clmssn not in (select cossn from seb2a21.specnew.dbo.claims where completedt is null)
group by t.doc