Max in sql passthru query

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.
 
D

dchristo

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'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top