When.com Web Search

Search results

  1. Results From The WOW.Com Content Network
  2. Need help guys! SQL SUM function is aggregating the integer ... -...

    www.reddit.com/r/SQL/comments/s1hu01/need_help_guys_sql_sum_function_is...

    Please help me out here guys! Thank you. you must delimit the column names properly, otherwise 01 will always be interpreted as an integer rather than a column name. in MySQL, delimiting is accomplished with the backtick. so you need. , SUM(`01`) as '01 hour'. , SUM(`02`) as '02 hour'. , ...

  3. Using window function in group by… why Sum(Sum))? : r/SQL -...

    www.reddit.com/r/SQL/comments/13ofm7k/using_window_function_in_group_by_why_sumsum

    Sum, by itself, is a real aggregate. It combines the values from multiple rows as they are combined together. SELECT Month , SUM(Amount) AS MontlyTotal , SUM(SUM(Amount)) OVER AS GrandTotal FROM Table GROUP BY Month. So in this query, SUM(Amount) is a standard aggregate, combining values from individual rows into a monthly total.

  4. SQL equivalent of SUMIF, in same table as the data : r/SQL -...

    www.reddit.com/r/SQL/comments/12wl3z2/sql_equivalent_of_sumif_in_same_table_as...

    SQL Server. Hi all, Can you please advise on how to do the equivalent of sumifs in Excel - particularly as a secondary column in the same table as the data itself. Using the below as an example, ideally I'd like to produce this in SQL (assume the database table name is "Company"): Focus being on the "Division_Size", which sums up the team sizes ...

  5. Very new to SQL. Wondering why my SUM function doesn't work

    www.reddit.com/r/SQL/comments/xnrebd/very_new_to_sql_wondering_why_my_sum_function

    This is because it only has one thing to sum, the sales be for that week. You want to only select (and group by) the employee. Still SUM the salesbyweek. Then the SUM function will add up all the salesbyweek figures it has for that employee. Something like: SELECT EmployeeId.

  6. Finding MAX of SUM - who makes max purchases? : r/SQL - Reddit

    www.reddit.com/r/SQL/comments/ozcsxp/finding_max_of_sum_who_makes_max_purchases

    If you group the sums by customer, you get the order total sums for each customer with sum function. Then we will use this table query (subquery) as new table in the big query. SELECT CustomerID, MAX (sums) FROM ( SELECT CustomerID, SUM (ORDER_TOTAL) AS sums FROM table? GROUP BY CustomerID) as sub_table ); So you have selected the maximum ORDER ...

  7. Sum / partition vs sum / group. : r/SQLServer - Reddit

    www.reddit.com/r/SQLServer/comments/wyqpd0/sum_partition_vs_sum_group

    I think there is some potentional context missing ... Using sum/partition will give you the same value for every row in the same partition. Group by will only give you values by partition. The best question is ... what is the result you are looking for.

  8. SUM CASE date range - Snowflake : r/SQL - Reddit

    www.reddit.com/r/SQL/comments/ghyxtz/sum_case_date_range_snowflake

    SUM(CASE WHEN l.pull_date BETWEEN m.interest_start_date AND m.interest_end_date THEN daily_libor END) AS accum_daily_libor. FROM accounting m. LEFT JOIN libor_rates_table l ON l.pull_date = m.interest_start_date. GROUP BY 1,2,3,4. Thanks a lot! By the way, the DBMS is Snowflake, not MYSQL. There's no option for it however.

  9. Sum colums in one table and join with another table : r/SQL -...

    www.reddit.com/r/SQL/comments/16p2f0e/sum_colums_in_one_table_and_join_with...

    i have tried joining (inner) the two tables, but obviously this just returns one or all of the rows assocated with a consignmentid rather than summing the quantity colum. i can also perform the sum fuction in thw quantity table using the query below: select. consignmentid, quantity = sum (quantity) from consignmentitemstbl. group by ConsignmentId.

  10. (Help request) Sql query to remove zero sum : r/SQL - Reddit

    www.reddit.com/r/SQL/comments/iq2kno/help_request_sql_query_to_remove_zero_sum

    It would help to see the query and some sample data. depending on where in the query this data is coming from you could pick a few different routes. You could use a MySQL equivalent to the CASE expression if you wan to eliminate the zeros in the SELECT statement or like u/r3pr0b8 said you could use the having clause. Please reformat your post ...

  11. SQL Running total, reset when a column is a certain value?

    www.reddit.com/r/SQLServer/comments/nxmrq6/sql_running_total_reset_when_a...

    I want running totals between SHIFT START and SHIFT END. I'm using this OVER window function to get the RunningDurationTotal. ,SUM (loginDuration) OVER (. PARTITION BY [Initials] ORDER BY [Login] ) AS RunningDurationTotal. [Initials] are the user_id and [Login] is the time. So right now it resets when it hits another user but I need it to reset ...