sql server - Incremental count based on criteria -



sql server - Incremental count based on criteria -

is there anyway can archive following? need count based on subject itself.

student term subject count ------------------------------------------------------ 0001 aug2013 abc1234 0 0001 jan2014 abc1234 1 0001 jan2014 def1234 0 0001 may2014 abc1234 2 0001 may2014 ghi1234 0

try this

select student, term, subject, row_number() on (partition student, subject order term)-1 count tablename

sql-server sql-server-2008

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -