| Author |
Topic |
|
wtrihardiny
Starting Member
12 Posts |
Posted - 2008-06-16 : 11:33:11
|
| * |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-16 : 11:38:13
|
| [code]select cp.clientpolicyno, cp.baseclaimID,sc.effectivedate as StatusChangeDatefrom claimpolicy cpjoin StatusChange sc on sc.ownerOID = cp.BaseClaimID and sc.OwnerTypeCode = 70 join (select ownerOID,max(EffectiveDate) as maxdate from StatusChange where OwnerTypeCode = 70Group BY ownerOID) tON t.ownerOID=sc.ownerOIDAND t.maxdate=sc.EffectiveDatewhere cp.clientpolicyno = 88710575 [/code] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-16 : 11:51:44
|
| [code]SELECT t.clientpolicyno, t.baseclaimID,t.StatusChangeDateFROM(select ROW_NUMBER() OVER(PARTITION BY cp.clientpolicyno ORDER BY sc.effectivedate DESC) AS RowNo,cp.clientpolicyno, cp.baseclaimID,sc.effectivedate as StatusChangeDatefrom claimpolicy cpjoin StatusChange sc on sc.ownerOID = cp.BaseClaimID and sc.OwnerTypeCode = 70 where cp.clientpolicyno = 88710575)tWHERE t.RowNo=1[/code] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-16 : 12:02:35
|
| [code]select cp.clientpolicyno, MIN(cp.baseclaimID),MIN(sc.effectivedate) as StatusChangeDatefrom claimpolicy cpjoin StatusChange sc on sc.ownerOID = cp.BaseClaimID and sc.OwnerTypeCode = 70 join (select cp1.clientpolicyno,max(sc1.EffectiveDate) as maxdate from claimpolicy cp1join StatusChange sc1on sc1.ownerOID = cp1.BaseClaimID and sc1.OwnerTypeCode = 70Group by cp1.clientpolicyno ) tON t.clientpolicyno=cp.clientpolicynoAND t.maxdate=sc.EffectiveDatewhere cp.clientpolicyno = 88710575GROUP BY cp.clientpolicyno[/code] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-16 : 12:49:30
|
quote: Originally posted by wtrihardiny YAY!!! IT WORKED!!! THANK YOU SO MUCH VISAKH16! YOU ARE THE BEST!
You're welcome |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-11-18 : 10:09:36
|
great.. now we just need to guess what he was doing _______________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.1 out! |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2008-11-18 : 10:31:00
|
| Guess he waited till now to delete the original post to make sure it was no longer in Google cache.CODO ERGO SUM |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-18 : 11:13:27
|
| I really cant understand what these people gain from deleting their original questions? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|