Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Weird MySQL Behavior
Message
De
15/02/2011 08:03:07
 
 
À
15/02/2011 07:56:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MySQL
Application:
Desktop
Divers
Thread ID:
01500180
Message ID:
01500216
Vues:
39
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform