in reply to unique fields in bar delimited record
Not that the previous solutions aren't the perliest way to do it, but you could use DBD::AnyData and actually use your SQL (with a little tweaking).