FROM aqbudgets
JOIN aqbudgetperiods USING (budget_period_id)|;
# show only period X if requested
my @where_strings;
# Pick out the active ones
if ($budget_period_id) {
push @where_strings," aqbudgets.budget_period_id = ?";
-