Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select Group by problem
Message
From
04/09/2003 01:20:01
 
 
To
03/09/2003 21:17:44
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00825813
Message ID:
00825894
Views:
22
The SELECT has the following fields listed:

building.name
master.roomnum
master.invnum
master.oldinvnb
master.objname
master.surdte
master.surdte2
master.objmat
master.objdesc
desc
deptname

You must include each of them in the GROUP BY too, unless any of them are memo or general.

Again, from the help file (emphasis is mine):

The GROUP BY clause does not support Memo or General fields.
The GROUP BY clause must list every field in the SELECT list
, except for fields contained in an aggregate function, such as the COUNT( ) function. In addition, the GROUP BY clause must also list every field in a HAVING clause, except for fields contained in an aggregate function.

>>
>>
>
>I read the help file. I know I am missing something, I not sure what. Can some one please point out my mistake, oversight. I feel real dumb right now.
>
>>
>>
>>>I have read the documentation and several articles. I still can not get the following code to work.
>>>
>>>lcReocrdRange = ' '     && in real code this is a calculation
>>>Select building.name , ;
>>>		master.roomnum , master.invnum , master.oldinvnb , ;
>>>		master.objname , master.surdte , master.surdte2  , ;
>>>		master.objmat  , ;
>>>		master.objdesc , ;
>>>		padr(reduce(CHRTRAN(CHRTRAN(master.objdesc , ;
>>>			CHR(13),''), CHR(10),''), SPACE(1)),254)  AS desc , ;
>>>		department.name  AS deptname  ;
>>>	From master, building, department ;
>>>	Where building.code = master.inscode ;
>>>		AND department.code = master.deptcode ;
>>>		&lcReocrdRange ;
>>>	Group BY building.name  , ;
>>>			 master.roomnum , ;
>>>			 master.invnum    ;
>>>	Into CURSOR antiqsum
>>>
>>>I get the an error message that Group by clause is invalid or missing. What am I missing?
>>>
>>>Any help appreciated.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform