Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird MySQL Behavior
Message
From
15/02/2011 08:03:07
 
 
To
15/02/2011 07:56:07
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MySQL
Application:
Desktop
Miscellaneous
Thread ID:
01500180
Message ID:
01500216
Views:
41
Dennis,

what happens if you replace b.descriptor with pohdr.descriptor? Even better, what happens if you replace all As and Bs with for instance AA and BB, in order to avoid single letter aliases? Like this
SELECT AA.REFNO, AA.DATE, AA.SUPPLIERID, AA.TERMS, AA.TOTQTY, AA.AMOUNT, AA.REMARKS,
     AA.PREPAREDBY, AA.CHECKEDBY, AA.PRINTDATE, AA.POSTDATE, AA.CLOSED, AA.CANCELLED, AA.ID,
     BB.CODE AS SUPPCODE, BB.DESCRIPTOR AS SUPPNAME, BB.ADDRESS AS SUPPADDR
FROM pohdr AA JOIN SUPPLIER BB ON AA.SUPPLIERID=BB.ID  WHERE BB.DESCRIPTOR LIKE 'ABC%'
ORDER BY REFNO
>Tore,
>
>You write that you get the correct result. Are you sure that you see a different result, and not the result from the previous attempt?
>
>Positive sir. In my form class, I have a textbox where user types in some value. There is a combobox that allows user to choose field/column to search. Once user hits the Search button, it constructs the CA's SelectCmd on the fly.
>
>If the CA's SelectCmd only involves a single table source, everything is all fine. Problem arises when the SelectCmd is made up of more than one table source. Like the one I showed:
>
>SELECT A.REFNO, A.DATE, A.SUPPLIERID, A.TERMS, A.TOTQTY, A.AMOUNT, A.REMARKS,
>     A.PREPAREDBY, A.CHECKEDBY, A.PRINTDATE, A.POSTDATE, A.CLOSED, A.CANCELLED, A.ID,
>     B.CODE AS SUPPCODE, B.DESCRIPTOR AS SUPPNAME, B.ADDRESS AS SUPPADDR
>FROM pohdr A JOIN SUPPLIER B ON A.SUPPLIERID=B.ID  WHERE B.DESCRIPTOR LIKE 'ABC%'
>ORDER BY REFNO
>
>
>As you can see from the above code, B.DESCRIPTOR has an alias of SUPPNAME. If I use:
>
>WHERE SUPPNAME LIKE 'ABC%'
>
>It generates an error both on the VFP side, and on MySQL Query Browser.
>
>If I change it to:
>
>WHERE B.DESCRIPTOR LIKE 'ABC%'
>
>It works on MySQL Query Browser. In VFP side though, it first shows an error (trapped by my code) first (Unknown column in where clause), but show the correct results.
>
>Dennis
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform