Suppose if my Input is:
ID GroupID Qty
1 1 100
2 1 200
3 1 300
4 2 98
5 2 198
6 3 175
7 3 275
8 3 375
9 4 215
Output should be
ID GroupID Qty
1 1 100
4 2 98
6 3 175
9 4 215
Can any one help me how to do it with SQL Server T-SQL
query?
EDIT
Input
Output
The best and more flexible way in my opinion would be to use ROW_NUMBER(). The below I've tested for your example, just replace tmpTable with your table name:
read more about how to use ROW_NUMBER: https://docs.microsoft.com/en-us/sql/t-sql/functions/row-number-transact-sql