in reply to Re: Sort in multilevel hash
in thread Sort in multilevel hash
This is the code I build the hash from. I would like to sort on 'shiptofax' but it doesn't get this way... Regards,my $query = qq|SELECT s.shiptofax, s.shiptocountry, s.shiptophone, s.ship +toaddress1, s.shiptoaddress2, s.shiptocity, s.shiptostate, s.shiptozipcode, s.shiptocontact, s.shiptoname, s.shiptoemail, o.waybill, o.shipvia FROM shipto s, oe o WHERE ((trans_id = $form->{"$form->{vc}_id"}) AND ( o.id = +$form->{"$form->{vc}_id"}) AND ((to_date( s.shiptophone, 'YYYY-MM-DD') >= to_da +te( to_char(current_timestamp,'YYYY-MM-DD'), 'YYYY-MM-DD')) )) UNION SELECT s.shiptofax, s.shiptocountry, s.shiptophone, s.shiptoaddre +ss1, s.shiptoaddress2, s.shiptocity, s.shiptostate, s.shiptozipcode, s.shiptocontact, s.shiptoname, s.shiptoemail, o.waybill, o.shipvia FROM shipto s JOIN oe o ON (o.id = s.trans_id) WHERE ((o.$form->{vc}_id = $form->{"$form->{vc}_id"}) AND ((to_date( s.shiptophone, 'YYYY-MM-DD') >= to_da +te( to_char(current_timestamp,'YYYY-MM-DD'), 'YYYY-MM-DD')) )) UNION SELECT s.shiptofax, s.shiptocountry, s.shiptophone, s.shiptoaddres +s1, s.shiptoaddress2, s.shiptocity, s.shiptostate, s.shiptozipcode, s.shiptocontact, s.shiptoname, s.shiptoemail, a.waybill, a.shipvia FROM shipto s JOIN $table a ON (a.id = s.trans_id) WHERE ((a.$form->{vc}_id = $form->{"$form->{vc}_id"}) AND ((to_date( s.shiptophone, 'YYYY-MM-DD') >= to_da +te( to_char(current_timestamp,'YYYY-MM-DD'), 'YYYY-MM-DD')) ))|; if ($form->{id}) { $query .= qq| EXCEPT SELECT s.shiptofax, s.shiptocountry, s.shiptophone, s.shiptoaddress +1, s.shiptoaddress2, s.shiptocity, s.shiptostate, s.shiptozipcode, s.shiptocontact, s.shiptoname, s.shiptoemail, o.waybill, o.shipvia FROM shipto s, oe o WHERE ((s.trans_id = '$form->{id}') AND ( o.id = '$form->{id} +')) |; } my $sth = $dbh->prepare($query); $sth->execute || $form->dberror($query); my $ref; while ($ref = $sth->fetchrow_hashref(NAME_lc)) { push @{ $form->{all_shipto} }, $ref; } $sth->finish; $dbh->disconnect;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Sort in multilevel hash
by Anonymous Monk on Jan 09, 2012 at 09:46 UTC | |
|
Re^3: Sort in multilevel hash
by Anonymous Monk on Jan 09, 2012 at 08:58 UTC | |
by gueriniere (Initiate) on Jan 09, 2012 at 09:34 UTC | |
by roboticus (Chancellor) on Jan 09, 2012 at 11:00 UTC | |
by Anonymous Monk on Jan 09, 2012 at 09:51 UTC | |
by Anonymous Monk on Jan 09, 2012 at 09:55 UTC | |
|
Re^3: Sort in multilevel hash
by TJPride (Pilgrim) on Jan 09, 2012 at 23:30 UTC |