Skip to content
Advertisement

Tag: sum

Making cumulative sum with ids and dates in MySQL

Imagine I have this: id transactiondate transactiontag clientid transactionvalue 1 2020-12-28 pizza 0 29.99 2 2020-12-29 payment 0 -39.99 3 2020-12-28 cheese 0 -109.99 4 2020-12-28 cheese 0 -109.99 5 2020-12-28 pizza 1 -19.99 6 2020-12-28 cheese 1 -18.99 7 2020-12-28 salary 1 58.99 8 2020-12-29 salary 1 38.99 So I have all the Ids of transactions, when they were

sql get balance at end of year

I have a transactions table for a single year with the amount indicating the debit transaction if the value is negative or credit transaction values are positive. Now in a given month if the number of debit records is less than 3 or if the sum of debits for a month is less than 100 then I want to charge

Remove zero amount in a query

I have a table finalData with the following columns and data I am creating mysql query to display the income and expenses of Singapore per Area, but I have to exclude areas that has zero amount. Here’s the code I tried: Output should be like this Any help would be appreciated. Thanks Answer This logic would be simpler phrased with

Advertisement