in reply to Re^3: Sort in multilevel hash
in thread Sort in multilevel hash
I should find a way to get rid of all the double records (containing the same information) but thats another question... Regards/ G!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.s +hipvia|; $query .= qq| FROM shipto s, oe o WHERE ((trans_id = $form->{"$form->{vc}_id"}) AND ( trans_i +d = $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')) ))|; $query .= qq| 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')) ))|; $query .= qq| 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} +')) |; } $query .= qq| ORDER BY shiptofax, shiptostate |;
|
|---|