#14438 Fixed redundant multiple sql queries instead of a simple find over an array.