Re: DBI:CSV join ... flashback to 2002
- From: rroggenb@xxxxxxxxxxxxxxxxxxxxxxxxxxxx (Robert Roggenbuck)
- Date: Mon, 16 Jul 2007 15:25:28 +0200
The problem seems to be the dot in the table names. The dot have special meanings in SQL for table names and is not just an allowed character (for example it is used as scheme separator 'scheme.tablename'). Just try to rename Your CSV-files by cutting of the extension '.csv'. May be all the problems will be gone then.
Best regrads
Robert
----
ballard.d@xxxxxxxxx schrieb:
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");
[for Statement "Select a.subject from table_a.csv as a, table_b.csv asDBD::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.
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
.
- Follow-Ups:
- RE: DBI:CSV join ... flashback to 2002
- From: Curtis Leach
- RE: DBI:CSV join ... flashback to 2002
- References:
- DBI:CSV join ... flashback to 2002
- From: Ballard.D@xxxxxxxxx
- DBI:CSV join ... flashback to 2002
- Prev by Date: Re: [Oracle][ODBC]Numeric value out of range.
- Next by Date: Re: DBI requires 5.6.0 or 5.6.1?
- Previous by thread: DBI:CSV join ... flashback to 2002
- Next by thread: RE: DBI:CSV join ... flashback to 2002
- Index(es):
Relevant Pages
|
|