sweetblood has asked for the wisdom of the Perl Monks concerning the following question:
What I have now above crushes too much of the data. I need to see all the records for a couche_number and procedure_code, as it is now I only see one for each unique voucher/procedure. Maybe a hash is the wrong structure.my $sql = qq/select TOP 500 "vwGenSvcInfo"."Voucher_Number", "vwGenPatInfo"."Patient_Number", "vwGenPatInfo"."Patient_First_Name", "vwGenPatInfo"."Patient_Last_Name", "vwGenSvcInfo"."Service_Date_From", "vwGenSvcInfo"."Procedure_Code", "vwGenSvcPmtInfo"."Transaction_Type", "vwGenSvcPmtInfo"."Transfer_To_Carrier_Abbr" from ("Ntier_Training"."PM"."vwGenSvcPmtInfo" "vwGenSvcPmtInfo" INNER JOIN "Ntier_Training"."PM"."vwGenSvcInfo" "vwGenSvcInfo" + ON "vwGenSvcPmtInfo"."Service_ID"="vwGenSvcInfo"."Service_ID") INNER JOIN "Ntier_Training"."PM"."vwGenPatInfo" "vwGenPatInfo" + ON "vwGenSvcInfo"."Patient_ID"="vwGenPatInfo"."Patient_ID" order by Voucher_Number /; my $dbh = DBI->connect('DBI:ODBC:DATABOX'); my $sth = $dbh->prepare($sql); $sth->execute(); my %pats_hoh; while (my $pats = $sth->fetchrow_hashref) { #next unless exists($pats->{'Transaction_Type'}); my $voucher = $pats->{'Voucher_Number'}; my $proc_code = $pats->{'Procedure_Code'}; $pats_hoh{$voucher}{$proc_code}{Patient_Number} = $pats->{'Patient +_Number'}; $pats_hoh{$voucher}{$proc_code}{Voucher_Number} = $pats->{'Voucher +_Number'}; $pats_hoh{$voucher}{$proc_code}{Patient_Last_Name} = $pats->{'Pati +ent_Last_Name'}; $pats_hoh{$voucher}{$proc_code}{Transaction_Type} = $pats->{'Trans +action_Type'};
Any thoughts? - Help! Thanks!!!
Sweetblood
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Suggestions for handling a complex set of data
by NetWallah (Canon) on Mar 02, 2016 at 22:45 UTC | |
by chacham (Prior) on Mar 03, 2016 at 14:50 UTC | |
Re: Suggestions for handling a complex set of data
by poj (Abbot) on Mar 03, 2016 at 15:52 UTC |