Fixing mysql syntax issue