As far as I know you can do something like this: $rows_ref = $sth->fetchall_hashref( ['ID', 'AnotherID' ] )
To specify multiple ID's to be unique by, as I've had that same issue in the past. Then do a data Dumper to see what the structure looks like. David On Thu, Oct 1, 2015 at 8:30 AM, Yitzchak Scott-Thoennes <[email protected]> wrote: > On Wed, Sep 30, 2015 at 2:41 PM, Richard Reina <[email protected]> > wrote: > > Well something somewhat strange has happened. When I do: print > > Dumper($pats_ref) . "\n"; from the perl module that handles the DB query > it > > only prints one row: > > > > $VAR1 = { > > '8' => { > > 'ID' => '8', > > 'ANAME' => 'KOB', > > 'opp_team' => 'Cardinals', > > 'YEAR' => '2015', > > 'date' => '2015-09-04', > > 'AMOUNT' => '2.00', > > 'IDD' => '3', > > 'CHNAME' => 'DWB', > > 'CHLG_ID' => '12', > > 'SPONSOR' => 'MPK', > > 'season' => 'Fall' > > } > > }; > > > > This is baffling and very frustrating because when I do the exact same > query > > from the MySQL console it yields 3 row and not 1 row. > > > > ID | CHLG_ID | season | YEAR | date | opp_team | NAME | NAME > > | AMOUNT | sponsor | > > > +----+---------+--------+------+------------+----------+-----------+-----------------------------+--------+---------+------------- > > | 8 | 9 | Fall | 2015 | 2015-09-04 | Cardinals | KOB | AFA > > | 2.00 | MPK | > > | 8 | 12 | Fall | 2015 | 2015-09-04 | Cardinals | KOB | DWB > > | 1.00 | RFR | > > | 8 | 12 | Fall | 2015 | 2015-09-04 | Cardinals | KOB | DWB > > | 2.00 | MPK | > > > +----+---------+--------+------+------------+----------+-----------+-----------------------------+--------+---------+ > > > > Any insight as to why this might be happening would be greatly, greatly > > appreciated. > > You are telling DBI to put the results in a hash by ID. So later rows > overwrite earlier ones. > > You probably want fetchall_arrayref( {} ) instead of fetchall_hashref, > but I don't remember seeing what you want to end up doing with the > data. > _______________________________________________ > dancer-users mailing list > [email protected] > http://lists.preshweb.co.uk/mailman/listinfo/dancer-users >
_______________________________________________ dancer-users mailing list [email protected] http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
