Correct order of SQL requests
Signed-off-by: Nightmaster <nightmaster@seitaer.com>