Amol Jadhao

Amol Jadhao

  • NA
  • 585
  • 310.5k

How to maintain serial number for duplicate id in a table

Sep 16 2015 12:51 PM
lets consider i have a table like this
create table #temp
(
Id int primary key identity(1,1),
amount decimal(10,0),
inserted_date datetime,
empId int,
series_no int
)
when i will insert record with empId 1000 ,then i want to insert serial no 1,2,3 for that employee id.
again if employee id 1001 then serial number start with 1,2,3 so on.. 
how could i achieve this any suggestion? 
 
 
 

Answers (3)