Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor alias not found
Message
From
29/12/2013 12:37:56
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Cursor alias not found
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01591057
Message ID:
01591057
Views:
65
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
Next
Reply
Map
View

Click here to load this message in the networking platform