[ic] HELP! query returns wrong values (but right number)

Jeff Fearn jefffearn at gmail.com
Tue Mar 29 17:27:13 EST 2005


This is wrong:

my $sqm="SELECT DISTINCT id,name FROM aisle WHERE aisle.id=prodcat.aisle
AND prodcat.dept=".$deptrow[0];

Should be:

my $sqm="SELECT DISTINCT aisle.id, aisle.name FROM aisle, prodcat
WHERE aisle.id=prodcat.aisle AND prodcat.dept=".$deptrow[0];

Without the second table in the from you won't get the relationship.
It also probably isn't valid sql without it, but of course I have not
checked that ;)

I always find it best to ::Log("sql = $sqm\n") then cut N paste that
into mysql when I have sql errors, it makes debugging a bit easier.

Jeff


More information about the interchange-users mailing list