I have the following tables
productinfo:
ID|productname|productarea|productcost|productid
sales:
ID|salesid|productid|
salesdata:
ID|productid|productname|salestotal
Where I am having trouble is: salesdata.salestotal
is a varchar
column and may have nulls
Comparing the salesdata.saletotal
to the productinfo.productcost
columns.
I can do a
cast(salesdata.saletotal as float(7)) > X
and it works. I would like to do is
cast(salesdata.saletotal as float(7)) > productinfo.productcost
where
sales.productid = salesdata.productid and
productinfo.productid = salesdata.productid
However when I do that I get an error:
Error when converting type varchar to float
I found this post which was similar but am unable to get any other columns with it. I can not change the current db structure.