fixed some syntax errors
order was wrong in the query