Copyright Codenstuff.com 2017
YOU NEED TO BE LOGGED IN TO USE THIS FEATURE


Register
Credits
0
Reputation
0
Sqlite with Sum support?
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.


User avatar
Sqlite with Sum support?
Sqlite with Sum support?
Hello,

Can someone helpme please
i need to know how we can use the SUM function with our column table

for example i need to calculate the Amount of all records but need to split them if row contains 1,2,3
accounts.type:
id,name
1 = Expense
2 = Income
3 = Refund

so how can we sum every amount of 1 ,2 ,3 in 1 single command?
and get the output to an Double

MyFunctions.iIncome = 0
MyFunctions.iExpense = 0
MyFunctions.iRefund = 0

Code: Select all
            Dim attributes As String = "Transactions.setdate,category.name,transactions.amount,transactions.description,transactions.id,groups.type,vendors.name,transactions.status,accounts.type"

            Dim whereClause As String = "transactions.category ='" & CurrentStatementsButton.Name & "' AND transactions.monthid ='" & CurrentStatementsButton.mMonthID & "' AND transactions.yearid ='" & CurrentStatementsButton.mYearID & "'"
            Dim fromClause As String = "LEFT JOIN category ON transactions.category=category.id LEFT JOIN groups ON transactions.type=groups.id LEFT JOIN vendors ON transactions.vendor=vendors.id LEFT JOIN accounts ON transactions.account=accounts.id"

            Dim empls As SQLiteDataReader = DataBase.executeQuery("SELECT " & attributes & " FROM transactions " & fromClause & " WHERE " & whereClause & " ORDER BY transactions.placecount ASC;")




Thanks


Online now

Users viewing this forum: No registered users and 1 browsing

cron