You guys were great awhile back to help me with the followingSELECT s.babr,s.sicid,isnull(s.SicDescription,'Non-Inst and/or not coded') as sicdescription,SUM(s.AccountMV) AS mv, SUM(s.AccountMV) / q.ps AS PercentileFROM SnapsRaw s INNER JOIN (SELECT babr, SUM(accountmv) ps FROM snapsraw WHERE monthend = '06/01/2007' GROUP BY babr) q ON q.babr = s.babrWHERE s.MonthEnd = '06/01/2007' and branchstate <> 'Institutional Agency'GROUP BY s.Babr, s.SicDescription, q.ps, q.babr,s.sicidhaving SUM(s.AccountMV) / q.ps > 0.0order by sicdescription
For some reason why I run it with my new months data, it just runs and runs and runs, if I run it with 05/01/2007 data it runs in a couple seconds. I am having a hard time identifying which fields I should pay attention to so that I can find the data that appears to be causing some type of loop