Subject: | prepare failed: ambiguous column name at dbdimp.c |
OS: Windows XP Service Pack 2
Perl Version: ActivePerl 5.8.3.809
Module Version: DBD-SQLite 1.07 for Windows via Active State PPM.
DB Version: $dbh->{sqlite_version} returns 3.0.7
Schema for table I am trying to query:
CREATE TABLE field (
id integer primary key,
name varchar(255),
area int(11),
soil_type varchar(255),
description text,
comments text,
farm_id int(11)
);
Code snippet:
my $dbh = &dsn();
my $select = $dbh->prepare( qq { select field.id, field.name,
field.area, field.soil_type, field.description,
field.comments, field.farm_id
from field, farm where field.farm_id=farm.id
and farm.id=? order by $by $order });
$select->execute();
Running this code gives the following error message:
DBD::SQLite::db prepare failed: ambiguous column name: name(1) at dbdimp.c line 263 at /DB.pm line 228.
If I type the exact same query into an SQLite3 (3.0.8) command line, it executes successfully.
Tyler Hepworth