I have a table with columns Name and unit.
A customer may have multiple unit.
I want to set sl no dynamically in sql like below image.

How can I do this?
I have a table with columns Name and unit.
A customer may have multiple unit.
I want to set sl no dynamically in sql like below image.

How can I do this?
Try this query
select ROW_NUMBER() OVER (Partition By name Order by unit) as sl,
name,Unit
from tablename