Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i crate table like this :-
id , name , Counter , date
--- ---- ------ -----
11 , ma , 1 , 15-2-2016
21 , kk , 2 , 15-2-2016
30 , dd , 3 , 15-2-2016
10 , ss , 1 , 16-2-2016
25 , dd , 2 , 16-2-2016

i want identity column's counter where date

What I have tried:

and when i insert become counter +1
Posted
Comments
[no name] 16-Feb-16 6:52am    
Records are already there in your table and you want to update Counter value or you want to insert the records like above?
Member 12244977 16-Feb-16 6:55am    
insert when i insert new row the counter column make +1 but when i change date ,column counter count from first
ZurdoDev 16-Feb-16 8:22am    
1. Reply to the comment so that the user is notified.
2. This is not clear. But all you probably have to do is use a case statement but I can't help because I cannot understand you.

1 solution

Try ROW_NUMBER() OVER (PARTITION BY [DATE] ORDER BY [DATE]) AS Counter
 
Share this answer
 
v2
Comments
Member 12244977 17-Feb-16 4:39am    
its work thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900