Re: [Emerald] monthly totals

Dale E. Reed Jr. ( (no email) )
Fri, 16 Jun 2000 09:29:26 -0700

Josh Hillman wrote:
>
> How is the "Total" field in an MBR's "Billing" tab calculated? I know
> conceptually how it's done, but don't know the technical details (such as a
> SQL script).
>
> I need to run a script that updates all active MBRs' Send Method to "EMail -
> Text" for any MBRs that pay monthly by "Postal Mail" and their monthly bill
> is less than $50.00. Using the formula for the "Total" field would be
> really handy here.

Its inline code and can get pretty complicated. A quick way would
be:

Select CustomerID, Sum(CASE WHEN sa.DiffCost=1 THEN isnull(sa.Cost,0)
ELSE at1.Cost END)