Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Help Needed Please!
Message
 
 
To
24/08/2001 12:48:09
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00548100
Message ID:
00548843
Views:
12
>>>Sorry. It gives me the error: "Cannot GROUP by aggregate field"
>>>
>>>I appreciate the effort though. :)
>>
>>Kevin,
>>
>>Did I ask you to quote message? :) My colleague tested it and it worked fine. Ok, here is her test, you need to use your field names:
>>
>>1.
>>select  min(divnumb) as f ,div.compnumb, ;
>>compname from div ;
>>join comp on div.compnumb=comp.compnumb ;
>>group by div.compnumb into dbf min
>>2.
>>select iif(min.f=divnumb,min.compname,space(30)) as compnumer, ;
>>divnumb, divname ;
>>from div left join min ;
>>on (min.f=div.divnumb and min.compnumb=div.compnumb)
>>
>>I then realized, that there is no need to make join in the first select, so it might be simplified.
>>
>>So, please, show me the code, you're replying to, I let you know, where is a mistake.
>>
>>BTW, I don't see your appreciation :)
>
>Nadya,
>It was a slight typo in group by 1.
>'Best' is attractive there :) I suspect a nonSQL approach might be longer in code but faster.
>Cetin

Here is it: (VFP7)
select companynam, div_name ;
    from company left join division ;
    on company.cKeyID=division.cKeyID ;
    into cursor curFinal readwrite 

select min(div_name) as div_name, companynam ;
from curFinal group by 2 ;
into cursor curTemp nofilter
index on companynam+div_name tag Temp

select curFinal
set relation to companynam+div_name into curTemp
replace companynam with '' for !found('curTemp')
Or lots of other variations.

Thanks Cetin, Renouir, Sergey for support :)
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform