Can anyone give me an idea why a statement like this would crash a database? Thanks
With
Stage1 As(Select acc_no, sum(col1) As s1,
sum(col2) As s2,
sum(col3) As s3,
sum(col4) As s4,
sum(col5) As s5,
sum(col6 + col7 + col8 + col9 + col10
+ col12 + col13 + col14 + col15
+ col16 + col17 + col18) As Aged_More_120
From tdw.aging
Where msr_prd_id = 200401
Group By acc_no),
Stage2 As(Select * From Stage1
Where s1 > 0 Or s2 > 0 Or s3 > 0 Or s4 > 0 Or s5 > 0 Or
Aged_More_120 > 0)
Select count(*) from Stage2;