I apologize all!
I had been working all last night with no sleep and was a little delirious when I was asking this question. Here is more clarification on what i'm trying to do.
The RefNum is a reference number and the Number
column is tied to those RefNum when a decision is added. So we could have the first reference number 1 and then 3 decisions tied to this and reference 2 and 5 decisions to this. My struggle is I don't know how to accomplish pulling the latest
decision. I understand how to pull the max of one field just not sure how to for 2 fields.
Additional data
create Table testTable (
ID int, Customer int, Refnum int, number int, sdate date, decision varchar(20))
Insert into testTable Values
(1651,1,1,1,'4/17/2015','Approved'),
(1652,1,1,2,'5/1/2015','Declined'),
(1653,1,2,1,'6/10/2015','Approved'),
(1654,2,1,1,'6/15/2015','Tentative'),
(1655,3,1,1,'6/15/2015','Tentative'),
(1656,3,1,2,'6/15/2015','Rejected'),
(1657,3,2,1,'6/15/2015','Approved'),
(1658,3,2,2,'6/15/2015','Declined'),
(1659,3,2,3,'6/15/2015','Tentative'),
(1660,3,2,4,'6/15/2015','Approved')
Expected result
ID Customer Refnum number sdate decision
1653 1 2 1 2015-06-10 Approved
1654 2 1 1 2015-06-15 Tentative
1660 3 2 4 2015-06-15 Approved
Customer 1, max refnum 2 and max number is 1
customer 2, max refnum 1 and max number is 1
customer 3, max refnum 2 and max number is 4
Hopefully this helps and Thank you all for replying and assistance!