Question about joining using DBI:CSV.  I must be making a stupid
mistake somewhere.

Earlier posts (2002) state that there were problems using aliases in
joins.  I've just installed the modules on a windows machine and am
having the same problems.
DBI (v1.58)
SQL-Statement(v1.15)
Text-CSV_XS(v.3)
DBD-CSV(v.22)
DBD-File(v.35)

Running a simple query with no aliases works.

When I run the same query with an alias i get an error message
(below). However, the error message is  followed by the correct query
results.

$sth = $dbh->prepare("Select b.subject from table_b.csv as b");
$sth = $dbh->prepare("Select a.subject from table_a.csv as a");
>>SQL ERROR: Table 'CSV' referenced but not found in FROM list!


I then tried a simple join (using where a.subject=b.subject). I get
the error referenced in previous posts.

$sth = $dbh->prepare("Select a.subject from table_a.csv as a,
table_b.csv as b where a.subject=b.subject");
>>DBD::CSV::st execute failed: Can't call method "col_names" on unblessed 
>>reference at c:\perl\site\lib\SQL\Statement.pm line 610, <GEN> line 1.
[for Statement "Select a.subject from table_a.csv as a, table_b.csv as
b where a.subject=b.subject"] at temp.pl line 14


I then tried using the join syntax instead of the WHERE statement as
suggested in the previous post, but i get an error message

$sth = $dbh->prepare("Select * from table_a.csv natural join
table_b.csv");
>> SQL ERROR: Couldn't parse the explicit JOIN!

table_a.csv
-----------------
chromosome,snp,subject,xx
1,rs1203,102,A
1,rs1203,1025,A
1,rs1203,1034,A
1,rs1203,1078,A

table_b.csv
-----------------
subject
102
1025
1034


If anyone has any suggestions, please let me know.  I would greatly
appreciate it.

cheers,
david

Reply via email to