Hi
I've got an issue with DBD::CSV and doing an SQL join on multiple tables. (It 
may be my understanding of SQL is slightly off, but any help rendered would be 
much appreciated.

I'm trying to do what I know as a "Left Join', where I get all the data from 
the 'Left hand' table, and details from the joined table if there is a record, 
or a blank field where there is no link. The data is basically:

Names.csv ------------
Name,Age
Peter,21
John,20
Julie,19

Ages.csv -------------
Age,Description
21,Perfect age
20,Two decades


The SQL I would use is:
SELECT Names.Name, Names.Age, Ages.Description
FROM [Names] LEFT JOIN Ages ON Names.Age = Ages.Age;

But DBD::CSV (that is, SQL::Statment) doesn't support the 'LEFT JOIN' syntax. 
Instead, I have to use:
SELECT Names.Name, Names.Age, Ages.Description
FROM Names, Ages WHERE Names.Age = Ages.Age;
This works where the records have a match, but this completely omits the 
record if there is no match.
How can I do a 'LEFT JOIN' with DBD::CSV? Any hints or ideas welcome.


Peter Lovett
--------------------------------------
Plus Plus Pty Ltd
phone:  02 9972 xxxx
mobile: 0419 147 xxx
email:  xxx @ plusplus.com.au
web:    www.plusplus.com.au
---------------------------------------

Reply via email to