refs #31469
postgres query to mysql query part1