[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


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
_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.