select id, name from fileone where id in (select id from filetwo) #### SQL ERROR: Bad table or column name 'select id from f2' has chars not alphanumeric or underscore! #### #! /usr/bin/perl use strict; use warnings; use DBI; my $dbh = DBI->connect("DBI:CSV:f_dir=.;csv_eol=\n;csv_sep_char=\t"); unlink 'out'; $dbh->do("create table out (id integer, name char(64))"); $dbh->{csv_tables}{f1}{col_names} = [qw(id name)]; $dbh->{csv_tables}{f2}{col_names} = [qw(id)]; my $d = $dbh->selectall_arrayref('select id, name from f1 where id in ( select id from f2 )', {});