tweaked sql for dupe returns