fixed mysql query

reduced inputs