Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
This Select Group claims to be Missing or Invalid
Message
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 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01252346
Message ID:
01252354
Vues:
21
All the non-aggregate fields have to be included in the group by

Just for openers, I don't see CSR_\Discount ( Is that backslash a typo?) or CSR_Percent. ( there are probably more )


>The honor of your assistance is requested. I've spent too many hours looking at this SQL-select statement trying to figure out why "The GROUP BY clause is missing or invalid". In the first part, I've added the field type/size at the end of the line. This is generating a cursor for a report.
>
SELECT Brk_Name, Brk_Address1, Brk_Address2		, ; && C25 C30 C30
>	CtZ_CityName, CtZ_State, CtZ_PostalCode		, ; && C25 C2 C10
>	Brk_Contact, Brk_SingleMultiple			, ; && Memo I4
>	Brk_ShippingRate, Brk_ShippingRules		, ; && Y8.4 Memo
>	CtV_DisplayOrder, CSR_DisplayOrder		, ; && I4 I4
>	CtV_StoreName, CSR_CertificateAmount 		, ; && C25 Y8.4
>	SUM(COr_Amount) AS COr_Amount_SUM		, ; && Y8.4
>	CSR_\Discount, CSR_Percent, CSR_OrgPercent	; && N5.2 N6.2 N6.2
>FROM ST!CertificateOrder					;
>	JOIN ST!CertificateSizeRate ON COr_CSRFK==CSR_PK	;
>	JOIN ST!CertificateVoucher ON CSR_CtVFK==CtV_PK		;
>	JOIN ST!Broker ON CSR_BrkFK==Brk_PK			;
>	LEFT JOIN ST!CityZip ON Brk_CtZfk==CtZ_PK		;
>WHERE COr_OrCFK = '00054'					;
>ORDER BY Brk_Name, CtV_DisplayOrder, CSR_DisplayOrder		;
>GROUP BY Brk_SingleMultiple, Brk_Name				, ;
>	CtV_DisplayOrder, CSR_DisplayOrder			, ;
>	CtV_StoreName, CSR_CertificateAmount			, ;
>	CSR_BrokerDiscount, CSR_FamilyPercent, CSR_OrgPercent	, ;
>	Brk_Address1, Brk_Address2				, ;
>	CtZ_CityName ,CtZ_State, CtZ_PostalCode, Brk_ShippingRate ;
>INTO CURSOR rc_OrderTabReport
>It works as expected without the SUM() and GROUP BY. I've made sure all the non-grouped fields are included and that there are no memo fields in the GROUP BY. Can you see what I've missed?
>
>TIA,


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform