Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursor alias not found
Message
De
30/12/2013 12:25:58
 
 
À
29/12/2013 15:57:31
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 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01591057
Message ID:
01591096
Vues:
47
>>Hi All:
>>
>>Why am I getting the following message on the second SQL statement?
>>
>>Alias 'CURTEMP' not found
>>
>>When I do a suspend just before the 2nd SQL statement I can see the alias CURTEMP!
>>
>>
>>SELECT Foo.Custno, Foo.ITEM, Foo.DATE, MAX(Foo.CustPrice) AS CustPrice, MAX(Foo.CustCost) AS CustCost ;
>>	FROM ( ;           												&&Open Paren 1
>>	SELECT a_artran.Custno Custno, ;                                                              
>>	a_artran.ITEM ITEM, ;
>>	a_artran.price CustPrice, ;
>>	a_artran.cost CustCost, ;
>>	a_armast.invdte DATE ;
>>	FROM a_artran ;
>>	INNER JOIN a_armast ;
>>	ON a_armast.invno = a_artran.invno ;
>>	WHERE a_armast.invdte > DATE() - 400 ;
>>	UNION ALL ;
>>	SELECT a_arytrn.Custno Custno, ;
>>	a_arytrn.ITEM ITEM, ;
>>	a_arytrn.price CustPrice, ;
>>	a_arytrn.cost CustCost, ;
>>	a_arymst.invdte DATE ;
>>	FROM a_arytrn ;
>>	INNER JOIN a_arymst ;
>>	ON a_arymst.invno = a_arytrn.invno ;
>>	WHERE a_arymst.invdte > DATE() - 400 ;
>>	) Foo ;                                							&&Close Paren 1
>>	INNER JOIN ( ;													&&Open paren 2
>>	SELECT Custno, ITEM, MAX(DATE) AS DATE ;                       
>>	FROM ( ;                                                        &&Open paren 3
>>	SELECT a_artran.Custno Custno, a_artran.ITEM ITEM, a_armast.invdte DATE ;    
>>	FROM a_artran ;
>>	INNER JOIN a_armast ;
>>	ON a_armast.invno = a_artran.invno ;
>>	WHERE a_armast.invdte > DATE() - 400 ;
>>	UNION ALL;
>>	SELECT a_arytrn.Custno Custno, a_arytrn.ITEM ITEM, a_arymst.invdte DATE ;
>>	FROM a_arytrn ;
>>	INNER JOIN a_arymst ;
>>	ON a_arymst.invno = a_arytrn.invno ;
>>	WHERE a_arymst.invdte > DATE() - 400 ;
>>	) Foo ;															&&Close paren 3
>>	GROUP BY Custno, ITEM ;
>>	) Foo1 ;														&&Close paren 2
>>	ON Foo.Custno = Foo1.Custno ;
>>	AND Foo.ITEM = Foo1.ITEM ;
>>	AND Foo.DATE = Foo1.DATE ;
>>	GROUP BY Foo.Custno, Foo.ITEM, Foo.DATE ;
>>	INTO CURSOR curTemp
>>	
>>	SELECT curTemp.*, a_icpric.unitpr1 PricPrice ;
>>	FROM curTemp ;
>>	outer JOIN a_icpric ;
>>	ON curTemp.item = a_icpric.item ;
>>	AND curTemp.custno = a_icpric.custno ;
>>	INTO CURSOR curLatestPrices
>>
>>
>>Thanks,
>>
>>Yossi
>
>
>If James' suggestion doesn't work try
>
>SELECT DBF( curTemp).*, a_icpric.unitpr1 PricPrice ;
> FROM DBF(curTemp) ;
>
>etc

I did a quick test and neither solution seems to work. But no worries, I was able to eliminate the second SQL statement altogether. Still wondering, though...
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform