diff --git a/phosta.pl b/phosta.pl
index a64676abfd9588b877bc8ba9b7a214b1f81b0d40..39098c1d95cc4e9a475e4ed7eb6e1a6cea23b0b8 100755
--- a/phosta.pl
+++ b/phosta.pl
@@ -107,7 +107,7 @@
if ($selected ne '')
{
$fieldlist = $fieldlist . $selected . ', ';
- $grouplist = $grouplist . ','. $selected;
+ $grouplist = $grouplist . ($grouplist ne '' ? ',' : '') . $selected;
}
if ( $grouplist ne '' ) { $grouplist = 'GROUP BY '. $grouplist; }
@@ -127,7 +127,7 @@ say '';
my $tb = Text::SimpleTable::AutoWidth->new();
- #say get_sql($selected, $grouping);
+ say get_sql($selected, $grouping);
my $stmt = $dbh->prepare(get_sql($selected, $grouping));
$stmt->execute();
while (my @row = $stmt->fetchrow_array)