I have 3 questions about the following code -
(taken from sub modify_search_results in Dbsql/Home.pm )
1/ Can $obj->select_options be applied to $obj->query_sth in the code below or is it only used with $obj->select???
2/ After reading up on GROUP BY it appears that whatever columns are in the SELECT must also be in the GROUP BY. Does this mean that $obj->query_sth automatically selects only the columns named in the GROUP BY or does it select all columns by default??? If it selects all columns then the GROUP BY would not be reliable.
3/ (If the answer to question 1 is "NO") How can I impliment the GROUP BY into $obj->query_sth???
my $group = "GROUP BY col1, col2";
$self->{db}->select_options($group);
# Do the search and count the results.
my $sth = $self->{db}->query_sth ($self->{cgi}) or return $self->modify_search_form($GT::SQL::error);
Thank you.
Simon.
(taken from sub modify_search_results in Dbsql/Home.pm )
1/ Can $obj->select_options be applied to $obj->query_sth in the code below or is it only used with $obj->select???
2/ After reading up on GROUP BY it appears that whatever columns are in the SELECT must also be in the GROUP BY. Does this mean that $obj->query_sth automatically selects only the columns named in the GROUP BY or does it select all columns by default??? If it selects all columns then the GROUP BY would not be reliable.
3/ (If the answer to question 1 is "NO") How can I impliment the GROUP BY into $obj->query_sth???
my $group = "GROUP BY col1, col2";
$self->{db}->select_options($group);
# Do the search and count the results.
my $sth = $self->{db}->query_sth ($self->{cgi}) or return $self->modify_search_form($GT::SQL::error);
Thank you.
Simon.