Where clause generator for a target set