Hello.

On Thu, May 16, 2002 at 12:10:10PM -0400, [EMAIL PROTECTED] wrote:
> At 11:25 AM 5/16/2002, Alexander Keremidarski wrote:
[...]
> >It is normal to have a difference there. It is not beacuse of how
> >concat() and() concat_ws() work, but how GROUP BY works.
> 
> Is this 'unpredictable behavior' documented anywhere as I must have
> missed or glossed over it?

I think Alexander referred to this:

http://www.mysql.com/doc/G/r/Group_by_functions.html
----------------------------------------------------------------------
MySQL has extended the use of GROUP BY. You can use columns or
calculations in the SELECT expressions that don't appear in the GROUP
BY part. This stands for any possible value for this group . You can
use this to get better performance by avoiding sorting and grouping on
unnecessary items. 
[...]
In ANSI SQL, you would have to add customer.name to the GROUP BY
clause. In MySQL, the name is redundant if you don't run in ANSI mode.

Don't use this feature if the columns you omit from the GROUP BY part
aren't unique in the group! You will get unpredictable results.
----------------------------------------------------------------------

> Is there a technical nutshell guide on explaining the GROUP BY
> behavior and/or nuances?

See above.

> Is there an explanation as to _why_ the field display width was
> restricted to 12 characters in conjunction with GROUP BY?

See my other mail. This is a bug indeed and independend of the mistake
in your query that Alexander pointed out.

> >In order to get predictable result you need to use:
> >
> >select concat_ws('.',oct1,oct2,oct3,oct4) as IP, count(*) as c from
> >ips group by IP [having c > 1];

Just to be sure to get it straight: Alexander is completely right that
your query should be rewritten, else you could get unexpected results.

But as far as I can tell, you also observed a real bug, which is
reproducable for me even with the change suggested by Alexander.

Regards,

        Benjamin.

-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to