Max in sql passthru query

  • Thread starter Thread starter dchristo
  • Start date Start date
D

dchristo

In the following there can be more than one (uniq_id) for the caseno in
dbo.master. I need the max(uniq_id) or last per caseno. I can do it when I
am only using one table, but I cannot seem to figure it out when there is
more than one table involved.

SELECT dbo.inform.code1, dbo.inform.nmlong, dbo.inform.desc1,
dbo.master.uniq_id, dbo.master.caseno, dbo.master.clnam, dbo.master.state
FROM dbo.inform INNER JOIN dbo.master on dbo.inform.code1=dbo.master.clnam
WHERE DBO.INFORM.CD_TYPE = 'CL' AND DBO.MASTER.CLOSED = '0'
ORDER BY dbo.flat_master.loanno

Any help would be appreciated.
 
Updated:

SELECT dbo.inform.code1, dbo.inform.nmlong, dbo.inform.desc1,
dbo.master.uniq_id, dbo.master.caseno, dbo.master.clnam, dbo.master.state
FROM dbo.inform INNER JOIN dbo.master on dbo.inform.code1=dbo.master.clnam
WHERE DBO.INFORM.CD_TYPE = 'CL' AND DBO.MASTER.CLOSED = '0'
 
Back
Top