First Daniel J Bower wrote:

>>> The following worked under MI 5.5 and earlier, but causes an error in
>>> MI 6.0:
>>>
>>>     Select Sum(ObjectLen( obj, "mi" )) from MyTable
>>>             where CodeField = "MyCode" and Str$(obj) = "Polyline"
>>>             Into MySelection Group by CodeField Order by CodeField
>>>
>>> "CodeField" is a field in MyTable. Previously, you could order and/or
>>> group by fields that were not in the selection.  Now these fields have
>>> to be in the list of selected fields, e.g.,
>>>
>>>     Select Sum(ObjectLen( obj, "mi" )), CodeField from MyTable
>>>             where CodeField = "MyCode" and Str$(obj) = "Polyline"
>>>             Into MySelection Group by CodeField Order by CodeField
>>>
>>> Guess I'll have to look at all of my MapBasic code and try to find all
>>> the places where I've done this....

Then Bill Thoen wrote:

>>Your SQL syntax seems a bit wierd. Why do you need 'group by' and
>>'order by' anyway? Doesn't this get you the same thing?
>>
>>     Select Sum(ObjectLen( obj, "mi" )) from MyTable
>>             where CodeField = "MyCode" and Str$(obj) = "Polyline"
>>             Into MySelection

Then Dmitry Bogdanov wrote:

>No, they do not get the same thing. SUM and GROUP BY must produce sums for
>each unique value of the GROUP BY field(s), when simple SUM without GROUP
>BY produces single row with sum of all records satisfying the criteria.
>
>Regarding original posting - looks like a bug in MI 6.0. There should not
>be requirements that field(s) appearing in GROUP BY/ORDER BY must be
>selected. Thanks for pointing on this.

To which our engineer responds:

We fixed a bug in MapInfo Professional version 6.0 which required us to
changed the allowed syntax. You can still (as always) ORDER BY on fields
not in the projection list. However, you can no longer GROUP BY fields not
in the projection list. The fact that we used to allow this (and did not
always do it properly, hence the problem) was a bug. We don't think you'll
find another SQL processor that allows this.


----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to