I have a query as follows and it is giving an extra 'undef' result while fetching the results.

        my $item_cost_details_rs = $self->item_db()->resultset('ItemDetails');
        my @min_cost_items = $item_cost_details_rs->search(
            {},
               {
            
                join        => 'item_mappings',
                select      => [
                    { min => 'item_mappings.item_mapping_cost' },
                    'item_mappings.item'
                ],
                as          => [
                    'cost',
                    'item'
                ],
                group_by    => [
                    'item_mappings.item'
                ]
            }
        );
        foreach my $row (@min_cost_items){
            my %details_item = $row->get_columns();
            use Data::Dumper::Simple;
            print STDERR Dumper(%details_item);
        }


There are only 2 results to display. But in foreach loop it s getting an undef result in first looping. 2nd and 3rd looping give me the actual result.

%details_item = (
                  'item' => undef,
                  'cost' => undef
                );
--

<<attachment: tom.vcf>>

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to