So I have one SQL table that contains the below columns: There are ~2800 unique License numbers and will have numerous FundsIn each day. I am trying to find the last date there was activity (ActivityDate) and the sum of all of the FundsIn on that MAX ActivityDate. Below is a query I’ve been trying to modify to get it
Tag: sum
Partition Over Clause with start and stop
I have a set of data where value is calculated starting from 1 – 12 then moves 1 step down and calculates another 1 – 12. This works well in Excel however how do I achieve this in SQL. Is it even possible? I have tried which gives me a list of numbers then restarts after 12 so I want
How query two different Sum from the same table for the same column but with different condition?
I would like to fetch the sum of field TOTAL for active users and sum of field TOTAL for inactive users. Expecting is the query that results activeTotal = 15 and InactiveTotal = 50 SELECT SUM(actUser.total) as activeTotal, SUM(inActUser.total) as inactiveTotal FROM user actUser JOIN user inActUser ON inActUser.id = inActUser.id WHERE (actUser.active = 1 AND actUser.userId = 1) OR
convert access group by query to sql server query
I’m unable to convert MS Access query to SQL SERVER Query, with changing the group by columns because it will effect in the final result. The purpose of this query is to calculate the Creditor and …
right way to get sum of all the counts done in sql
This is my query, I want to get how many numbers of phones call received today as one column, so how do I do a sum using count function? If I do a sum, that would just return the total sum? how do I return the total numbers of all calls received today, I would do count uniquecallerID and then
Create a descending list of orders per item and display the ranking position in seperate column
DB-Fiddle Expected Result: In the results above I want to create a descending list of all orderIDs per itemID. Starting from the newest order to the oldest order which is defined by the event_date. The position of an orderID within a certain itemID should be displayed in column position. I tried to go with this query but could not make
SQL group and summing at new row
I have an issue where I am trying to create a new “row” (not part of the database) where it only gives me the SUM of the “count” column. I am wondering if that is possible? I tried adding the SUM(count(cost) as “total product cost” OVER() AS Total_Count; but that just creates a new column with the summed amount of
SQL query using Sum() and count() functions
I’m trying to query in PostgresQL using the SUM function to get the total of 3 different row types (Root, Dynamic, Test). I used the Sum() function for the first attempt and the Count() function for the second attempt; both didn’t work sadly. I expect a syntax error (since I’m a beginner at using SQL), but I’m not sure what
SQL Group by Transpose
I have the following Table charges Using the following query gets my the counts by Charge and Date Is there a way to transpose this to get the following? Thank you. Answer Use conditional aggregation:
Oracle SQL – Sum next X number of Rows
I have a table in Oracle database whith projected sales per week and would like to sum the next 3 weeks for each week. Here is an example of the table for one product and what I would like to achieve in the last column. I tried the Sum(Proj Sales) over (partition by Product order by Date), but I am