List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:September 21 1999 1:05am
Subject:Re: join + group by + concat(INT,...) Problem! (3.22.26a)
View as plain text  
On Tue, 1999-09-21 02:18:12 +0200, Benjamin Pflugmann wrote:
> What result did you expect? IMHO, the result below is as it should be
> correct. You group by test2PTR, which is different for each row, so
> all rows are displayed. Did you want to group by something like the
> first column?
[...]
> 
> On Tue, Sep 21, 1999 at 12:42:47AM +0400, andrews@stripped wrote:
> [...]
> > mysql> create table test ( i1 int(1), i2 int(2), i4 int(4), test2PTR
> int(4));
> > Query OK, 0 rows affected (0.00 sec)
> > 
> > mysql> create table test2 (test2ID int(4));
> > Query OK, 0 rows affected (0.00 sec)
> > 
> > mysql> insert into test2 (test2ID) values (1),(2),(3);
> > Query OK, 3 rows affected (0.00 sec)
> > Records: 3  Duplicates: 0  Warnings: 0
> > 
> > mysql> insert into test (i1,i2,i4,test2PTR) values
> (1,1,1,1),(10,10,10,2),(100,100,100,3);
> > Query OK, 3 rows affected (0.00 sec)
> > Records: 3  Duplicates: 0  Warnings: 0
> [...]
> > ##########  Result of CONCAT -- wrong :((( 
> > mysql> select
> concat("---",i1,"---"),concat("---",i2,"---"),concat("---",i4,"---")
> >     ->  from test,test2 WHERE test2PTR=test2ID GROUP BY test2PTR;
> > +------------------------+------------------------+------------------------+
> > | concat("---",i1,"---") | concat("---",i2,"---") | concat("---",i4,"---") |
> > +------------------------+------------------------+------------------------+
> > | ---1---                | ---1---                | ---1---                |
> > | ---10--                | ---10---               | ---10---               |
> > | ---100-                | ---100--               | ---100---              |
> > +------------------------+------------------------+------------------------+

It's the number of dashes, not the numbers, what Andrew probably meant
(but he better should have said explicitly).

Obviously the root of the problem (or call it bug) is, that the field
i1 is defined to have a display width of only 1 character, but the
values 10 and 100 don't fit this display width.  I don't know, what
the "standard" behaviour than should be ...?

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
join + group by + concat(INT,...) Problem! (3.22.26a)Andrew Shirrayev21 Sep
  • Re: join + group by + concat(INT,...) Problem! (3.22.26a)Benjamin Pflugmann21 Sep
    • Re: join + group by + concat(INT,...) Problem! (3.22.26a)Martin Ramsch21 Sep
      • Re: join + group by + concat(INT,...) Problem! (3.22.26a)Bob Kline21 Sep
        • Re: join + group by + concat(INT,...) Problem! (3.22.26a)Michael Widenius22 Sep
          • Re: join + group by + concat(INT,...) Problem! (3.22.26a)Bob Kline22 Sep
      • Re: join + group by + concat(INT,...) Problem! (3.22.26a)Benjamin Pflugmann21 Sep
        • Re: join + group by + concat(INT,...) Problem! (3.22.26a)Martin Ramsch21 Sep
      • Re: join + group by + concat(INT,...) Problem! (3.22.26a)Michael Widenius22 Sep
    • Re: join + group by + concat(INT,...) Problem! (3.22.26a)Andrew Shirrayev21 Sep