Fix query on MySQL