# Miscellaneous > SQL Scripts >  How can i put second query in a cursor and loop it and how can i update the top query

## mcfarland

Need to update the data from last year to current year and I need to put 2 query in cursor and loop it and need to write an update statement and set the values HHFkoverride = 1,process = 1 and pay = 7
all these three columns are from SNLunchSevereNeeds table?



Select * from SNLunchSevereNeeds Where SystemCertificationID in( 
Select SystemCertificationID from SNSystemCertification where FiscalYear=2014 and 
 SystemID=749 And IsActive=1 
) 

Select * from SNLunchSevereNeeds Where SystemCertificationID in( 
Select SystemCertificationID from SNSystemCertification where FiscalYear=2013 
 And IsActive=1)

----------

