MySQL query cleanups.