Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GROUP BY overkill
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
GROUP BY overkill
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01248447
Message ID:
01248447
Views:
65
Hi all

I have the below select statement. Except for the first 2 fields in the GROUP BY none of them are necessary, of course I can change the ENGINEBEHAVIOR and get the query to run without the additional field. In any case I have listed all the TPATIENTS fields and the other fields that are in the SELECT statement, yet I am getting the message that the GROUP BY is missing or invalid. I have tried to remove the mAddress field (being a memo field) but no joy. Can someone spot what I am missing.

Thanks.
SELECT TPATIENTS.*, ;
		SPATIENTS.ISRNO, ;
		MTESTTYPES.CTYPE, ;
		SPATIENTS.IID, ;
		MDOCTORS.CNAME, ;
		SUM(SPATIENTS.YRATE) AS YRATE, ;
		CLUBTESTNAMES(SPATIENTS.IPID, MTESTS.ITYPE) AS CTEST ;
	FROM VSO3!TPATIENTS ;
		inner join VSO3!SPATIENTS on SPATIENTS.IPID = TPATIENTS.IID ;
		inner join VSO3!MTESTS on SPATIENTS.ITEST = MTESTS.IID ;
		inner join VSO3!MTESTTYPES ON MTESTS.ITYPE = MTESTTYPES.IID ;
		inner join VSO3!MDOCTORS ON TPATIENTS.IREFDOC = MDOCTORS.IID ;
	GROUP BY SPATIENTS.IPID, MTESTTYPES.IID, ;
		SPATIENTS.ISRNO, ;
		MTESTTYPES.CTYPE, ;
		SPATIENTS.IID, ;
		MDOCTORS.CNAME, ;
		TPATIENTS.IID, ;
		TPATIENTS.iPID, ;
		TPATIENTS.ddt, ;
		TPATIENTS.ino, ;
		TPATIENTS.cname, ;
		TPATIENTS.nage, ;
		TPATIENTS.ndays, ;
		TPATIENTS.cgender, ;
		TPATIENTS.irefdoc, ;
		TPATIENTS.maddress, ;
		TPATIENTS.idrreqno ;
	ORDER BY TPATIENTS.DDT, TPATIENTS.INO
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Next
Reply
Map
View

Click here to load this message in the networking platform