Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

Selecting data from table where sum of values in a column equal to the value in another column

select id, qty, checkvalue from (
    select t1.*,
           sum(t1.qty) over (partition by t2.id) [sum]
from #temp [t1] join #temp [t2] on t1.id <= t2.id
) a where checkvalue = [sum]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Selecting #data #table #sum #values #column #equal #column
ADD COMMENT
Topic
Name
7+6 =