sql bug in attendance