Is there anyway to make this query more efficient. I've been told that it uses to much memory. Thanks
With
Stage1 As(Select acc_no, sum(column1) as s1, sum(column2) as s2,
sum(column3) as s3,...
From Table1
Where Date = '??/??/????'
Group by acc_no),
Stage2 As(Select * From Stage1
Where s1 > 0 or s2 > 0 or s3 > 0 ...)
Select count(*) from Stage2;