Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with another stored procedure...

Status
Not open for further replies.

nc297

Programmer
Apr 7, 2010
162
US
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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top