Link to home
Start Free TrialLog in
Avatar of shpresa
shpresaFlag for United States of America

asked on

Select statement Query SQL

Hi Experts,
I need to create this report in sql by selecting the last record for each referralID. As you see below in the table i have the same referralID many times and i need to select 1 record per each referralID. That would be the last one entered, or the one with highest number of "StatusUpdateID". Suggestions?

Here is how the table looks like.
StatusUpdateID          ReferralID         Q1         Q2             Q3
1                                    685                      1           1                 2
2                                    685                      1            1                 1
3                                    685                      1           0                 0
4                                    688                       0           0                 1
5                                    688                      1            1                 1
6                                    689                      1              1               1
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial