Sunday 15 June 2014

sql - How to increment an int column on multiple rows -



sql - How to increment an int column on multiple rows -

i'm attempting add together 1 column in table ids meet criteria. there way without selecting column each id?

here i've attempted:

update attendancerecordreporting set penalty8 = penalty8 + 1 id = (select id employee id not in (select distinct cwid attendancerecord recorddate between '3/1/2014 12:00:00 am' , '6/1/2014 12:00:00 am') , section = 1)

the error receive

subquery returned more 1 value. not permitted when subquery follows =, !=, <, <= , >, >= or when subquery used expression.

use 'in' operator instead of '='

update attendancerecordreporting set penalty8 = penalty8 + 1 id in ( select id employee id not in ( select distinct cwid attendancerecord recorddate between '3/1/2014 12:00:00 am' , '6/1/2014 12:00:00 am' ) , section = 1 )

sql sql-server

No comments:

Post a Comment