I found a SELECT example on the web. When I try in my script, I get this error message:
Specifying DISTINCT when using aggregate functions isn't reasonable - ignored. at /usr/lib/perl5/site_perl/5.10.0/SQL/Parser.pm line 496.
#!/usr/bin/perl use warnings; use strict; use DBI; my $dbh = DBI->connect( "DBI:CSV:", undef, undef, { RaiseError => 1, AutoCommit => 1 } ); my $table = 'artikel'; my $array_ref = [ [ 'a_nr', 'a_name', 'a_preis' ], [ 12, 'Oberhemd', 39.80, ], [ 22, 'Mantel', 360.00, ], [ 11, 'Oberhemd', 44.20, ], [ 13, 'Hose', 119.50, ], ]; $dbh->do( "CREATE TEMP TABLE $table AS IMPORT(?)", {}, $array_ref ); my $sth = $dbh->prepare( "SELECT DISTINCT a_name FROM $table" ); $sth->execute(); $sth->dump_results(); $dbh->disconnect();
Does SELECT DISTINCT work with DBD :: CSV or is something wrong with my script?
change: output signal
'Oberhemd' 'Mantel' 'Oberhemd' 'Hose' 4 rows
I thought it should be
'Oberhemd' 'Mantel' 'Hose' 3 rows
Installed Versions:
Perl : 5.010000 (x86_64-linux-thread-multi) OS : linux (2.6.31) DBI : 1.609 DBD::Sponge : 12.010002 DBD::SQLite : 1.25 DBD::Proxy : 0.2004 DBD::Gofer : 0.011565 DBD::File : 0.37 DBD::ExampleP : 12.010007 DBD::DBM : 0.03 DBD::CSV : 0.26