Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Givng a new name to multiple Cursors for each month
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01512741
Message ID:
01512848
Views:
48
Hi,

This should do it:
FOR nMonth = 1 TO 12
	lcMonth = CMONTH(DATE(YEAR(DATE()),m.nMonth,1))
	ldFirstDayOfMonth = DATE(YEAR(DATE()), m.nMonth,1)
	ldLastDayOfMonth = IIF( nMonth < 12,  DATE(YEAR(DATE()), m.nMonth+1,1)-1 ,  DATE(YEAR(DATE()),12,31))

	SELECT lcMonth+" 2010" AS Month_Year, ;
		GrpID, ;
		Emp_ID, ;
		SUM(bill_prem) AS Month_Billed, ;
		BnftName, ;
		0000000.00 AS Month_Collected ;
	FROM tmp1 ;
	WHERE BETWEEN(bill_date, m.ldFirstDayOfMonth, m.ldLastDayOfMonth);
	INTO CURSOR ("tmp" +TRANSFORM(m.nMonth));
	GROUP BY GrpID, Emp_ID, BnftName

ENDFOR
>
Regards,

Koen
Previous
Reply
Map
View

Click here to load this message in the networking platform