Subject Re: Stored Proc vs View, which one has better performance?
Author trskopo
Ah, that's right, using having clause is much more simple, thanks a lot for that tip.

Sugi

> Have you considered just
>
> select id_cst,id_gd,sum(qty) qtySum from Tbl1
> group by id_cst,id_gd
> having qtySum > 0
>
> There's a slight benefit to the view or stored procedure because it doesn't
> have to be recompiled and optimized so often, but it's a pretty simple
> statement and you'd have to use it a lot to amortize the time you spent
> creating the view or procedure. As for whether the view or the procedure
> would be faster - in theory they should be about the same, but only you can
> demonstrate the difference between theory and practice. This should be
> easy to test and testing it on your actual data will give the most reliable
> results.
>
> Good luck,
>
> Ann
>
>