For anything that isn't just a basic row lookup from a single table, you should really just be writing the SQL yourself.