pcdj_d has asked for the wisdom of the Perl Monks concerning the following question:
And in another subroutine:my $sql = " SELECT incident.id AS i_id, incident.severity, incident.summary, action.id AS a_id, action.incident_id, action.description, action.note +s FROM incident, action WHERE incident.id = action.incident_id AND action.due_date > $date (a specified date) AND action.due_date < current_date() ORDER BY sort_date ASC " $sth->prepare($sql); $sth->execute(); while (my $href =$sth->fetchrow_hashref()) { my $details={}; $details->{'Incident ID'} = $$href{'i_id'}; $details->{'Action ID'} = $$href{'a_id'}; $details->{'Severity'} = $$href{'severity'}; $details->{'Summary'} = $$href{'summary'}; and so on... push(my @results, $details); } return @results
This will return something along the following lines:my @results = "first subroutine" foreach my $result (@results) { my $output = $result->{'Incident ID'}.", "; $output .= $result->{'Action ID'}.", "; $output .= $result->{'Severity'}.", "; $output .= $result->{'Summary'}.", "; and so on... $counter++ } return $output;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl/SQL query - grouping 'one to many' records
by ahmad (Hermit) on Dec 09, 2008 at 23:26 UTC | |
by pcdj_d (Initiate) on Dec 09, 2008 at 23:36 UTC | |
by jasonk (Parson) on Dec 10, 2008 at 02:04 UTC | |
|
Re: Perl/SQL query - grouping 'one to many' records
by duckyd (Hermit) on Dec 10, 2008 at 00:47 UTC | |
by pcdj_d (Initiate) on Dec 11, 2008 at 09:14 UTC |