0

I am trying to print the last check created to a vendor with name and TaxID but I am able to receive the result for only one vendor name.

Sql Query below:

       
 select distinct top 200 cl.ClaimNumber , con.Name, ch.CreateTime,con.TaxID from cc_claim cl 
 join cc_claimcontact ccon on ccon.ClaimID = cl.ID
 join cc_check ch on ch.ClaimID = cl.ID
 join cc_contact con on ccon.ContactID = con.ID
 where 
 ch.PayTo in  ('WYATT LAW FIRM, LTD','Liberty Mutual')
 and
 con.TaxID in('0001682-4774-2861000','0004291-4004-1924000')
 order by ch.CreateTime desc

I tried a query as above which basically connects check and claim table and gives me the latest check created time for one particular vendor but I want the query to give me the latest check created for all the vendors which I give an input as.

Below is the result which I am getting by writing above query: This is the result I got

Also I want to print only the first row for all the vendor name and TaxId

PM 77-1
  • 12,933
  • 21
  • 68
  • 111

0 Answers0