>>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