my $dbh = dbh;
my @where = ();
- my $orderby = "ORDER BY cust_main.custnum";
+ my $orderby;
# initialize these to prevent warnings
$params = {
}
}
- $orderby .= ", cust_main.$field";
+ $orderby ||= "ORDER BY cust_main.$field";
}
}
- # set select a customer only once. some joins create multiple customer records.
- my $select = 'DISTINCT ON (cust_main.custnum) ' . join(', ', @select);
+ my $select = join(', ', @select);
my $sql_query = {
'table' => 'cust_main',