share common mysql query codebase