When working with SQL's, you probably want to keep your program as simple as possible when constructing SQL's. I often use HEREDOC's to construct SQL queries.
Example:
my $sql = <<EOF;
SELECT a
FROM b
WHERE c
ORDER BY d
EOF
Where the a, b, c, d can be variables or hardcoded values.
This is certainly more readable than using a bunch of join's.