Reputation: 1851
Customer_Name Itemcode Order_Number Quantity ord u_es Avail. Fulfillment%
-----------------------------------------------------------------------------------------------------
oracle blaionuel 1019885 F130238518001 1 CET 0 0.00
oracle blaionuel 1132006 F130238518001 1 CET 1 100.000
oracle blaionuel 1016964 F130238518001 1 CET 0 0.00
I want to achieve an t-sql query that will introduce another column [Fulfilment% Order Level], which takes the least Fulfillment% of the 3 rows . I am using Mssql 2008 i.e
Customer_Name Itemcode Order_Number Quantity ord u_es Avail. [Fulfilment% Order Level]
-------------------------------------------------------------------------------------------------
oracle blaionuel 1019885 F130238518001 1 CET 0 0.00
Upvotes: 0
Views: 48
Reputation: 1271023
I think you are looking for row_number()
:
select t.*
from (select t.*,
row_number() over (partition by customer_name, order_number order by [Fulfillment%] asc) as seqnum
from table t
) t
where seqnum = 1;
Upvotes: 1