Fix wrong sql of attend