improved mysql syntax