Tom,
That is what I was illustrating as follows:
SELECT b.code, sv.Reference, sv.DateCreated,
SUM(svt.TransactionValue) as Total
from stored_value as sv
join stored_value_transaction as svt
on sv.id = svt.FKStoredValueID
and svt.recorddeleted = 0
join customer_order as co
on co.id = sv.FKCustomerOrderID
and co.recorddeleted = '0'
join branch as b
on b.id = co.fkbranchid
and b.recorddeleted = '0'
where sv.FKPaymentMethodID = '7' and sv.recorddeleted = '0'
GROUP BY b.code, sv.reference, sv.DateCreated
HAVING SUM(svt.TransactionValue) <> 0 -- Eliminate zero sums
Order By b.code, sv.reference
RLF
[quoted text, click to view] "Tom" <Tom@discussions.microsoft.com> wrote in message
news:952BA7D5-41B9-4B41-A9CB-38FEC4EBA9CF@microsoft.com...
> Sorry Russell.. Here is the code I'm working with. We want the "Total"
> field
> to not show zeros..
>
> SELECT b.code, sv.Reference, sv.DateCreated, SUM(svt.TransactionValue) as
> Total from stored_value as sv
> join stored_value_transaction as svt on sv.id = svt.FKStoredValueID and
> svt.recorddeleted = 0
> join customer_order as co on co.id = sv.FKCustomerOrderID and
> co.recorddeleted = '0'
> join branch as b on b.id = co.fkbranchid and b.recorddeleted = '0'
> where sv.FKPaymentMethodID = '7' and sv.recorddeleted = '0' GROUP BY
> b.code, sv.reference, sv.DateCreated Order By b.code, sv.reference
>
> "Russell Fields" wrote:
>
>> Tom,
>>
>> A piece of sample code or a little more explanation would help. I assume
>> you do not mean:
>>
>> SELECT AccountCode, AccountValue
>> FROM AccountTable
>> WHERE AccountValue <> 0
>>
>> Perhaps you mean:
>>
>> SELECT AccountCode, SUM(AccountValue) AS TotalValue
>> FROM AccountTable
>> GROUP BY AccountCode
>> HAVING SUM(AccountValue) <> 0
>>
>> RLF
>>
>> "Tom" <Tom@discussions.microsoft.com> wrote in message
>> news:3EAC5984-4844-4223-B910-20E81B0F2E41@microsoft.com...
>> > Running a query that adds up certain fields in our database and where
>> > applicable returns a zero total. Looking for a way to return only
>> > those
>> > lines that are not zero value.
>> >
>> > I'm new to this SQL thing, have experience in Access but am tripped up
>> > on
>> > this. Pls Advise
>>
>>
>>