That would be my first choice. I am a Perl developer by choice and a SQL user by necessity. I spent 5 hours last night with my head buried in a SQL book (re)learning all about left and outer joins, etc.
I have not yet figured out how to leverage the power of SQL to perform this trick.