Net Deals 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. 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 ...

  4. 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.

  5. 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 ...

  6. (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 ...

  7. How can I show a sum of 0 if no records exist in a query? : r/SQL...

    www.reddit.com/r/SQL/comments/kr2144/how_can_i_show_a_sum_of_0_if_no_records...

    One of the first things I tried. First let's address your performance issue. Load a #temp table with all the group and department combinations. Join to that temp table to get rid of your case statement. Just sum the hours, get rid of the subquery. Select sum (isnull (hours,0)) From #table Left join Table.

  8. 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.

  9. 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 ...

  10. Select items until sum of Quantity is at least X without using...

    www.reddit.com/r/SQLServer/comments/j5svjv/select_items_until_sum_of_quantity...

    Create a running total column using a windowed SUM and then apply a predicate that limits the running total... SELECT *. ,SUM([qty]) OVER (ORDER BY [something]) AS x. FROM [YourTable] If that is still slow, you may need a supporting index for your window function. To all the correct solution was from u/BobDogGo.

  11. 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.