fix sql queries

Signed-off-by: semteacher <semteacher@gmail.com>
more sql fix

Signed-off-by: semteacher <semteacher@gmail.com>