Search
 
SCRIPT & CODE EXAMPLE
 

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]
Comment

PREVIOUS NEXT
Code Example
Sql :: compare two tables to find unmatched records 
Sql :: python mysqlclient library not found for -lssl 
Sql :: multiple value select mysql 
Sql :: sql compound operators 
Sql :: systemctl mssql-server details 
Sql :: sql select upcoming birthdays 
Sql :: how to user id to show in from date to upto date in mssql server 
Sql :: sql queries for interview 
Sql :: tsql rename column name 
Sql :: how to fetch first 10 rows in sql 
Sql :: subquery in select 
Sql :: distance calculator from lat long sql query 
Sql :: SQL sort on a calculation 
Sql :: print pl sql 
Sql :: bigquery routine 
Sql :: How to Remove milliseconds from Date time 
Sql :: how to Activate the database 
Sql :: jooq finding lastest value in table 
Csharp :: how to make mouse invisible unity 
Csharp :: Add component object to gameobject unity 
Csharp :: c# getasynckeystate mouse 
Csharp :: como crear un numero aleatorio en c# 
Csharp :: how to remove a component from an object in unity 
Csharp :: c# or 
Csharp :: rigidbody2d freeze position 
Csharp :: how to get the startup path in console app 
Csharp :: check last character of a string c# 
Csharp :: setup authorize in swagger .net core 
Csharp :: bold caption latex 
Csharp :: C# cycle through directory 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =