Commit 555aa73b authored by unknown's avatar unknown
Browse files

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0

into dl145c.mysql.com:/home/ndbdev/tomas/mysql-5.1


sql/sql_select.cc:
  Auto merged
parents 34426138 fd39c731
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1116,3 +1116,4 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
ndb/src/dummy.cpp
+2 −0
Original line number Diff line number Diff line
@@ -58,6 +58,8 @@ INSERT INTO t1 VALUES (3359362,406,3359362,'Mustermann Musterfrau',7001,'2000-05
SELECT ELT(FIELD(kundentyp,'PP','PPA','PG','PGA','FK','FKA','FP','FPA','K','KA','V','VA',''), 'Privat (Private Nutzung)','Privat (Private Nutzung) Sitz im Ausland','Privat (geschaeftliche Nutzung)','Privat (geschaeftliche Nutzung) Sitz im Ausland','Firma (Kapitalgesellschaft)','Firma (Kapitalgesellschaft) Sitz im Ausland','Firma (Personengesellschaft)','Firma (Personengesellschaft) Sitz im Ausland','oeff. rechtl. Koerperschaft','oeff. rechtl. Koerperschaft Sitz im Ausland','Eingetragener Verein','Eingetragener Verein Sitz im Ausland','Typ unbekannt') AS Kundentyp ,kategorie FROM t1 WHERE hdl_nr < 2000000 AND kategorie IN ('Prepaid','Mobilfunk') AND st_klasse = 'Workflow' GROUP BY kundentyp ORDER BY kategorie;
Kundentyp	kategorie
Privat (Private Nutzung)	Mobilfunk
Warnings:
Warning	1052	Column 'kundentyp' in group statement is ambiguous
drop table t1;
CREATE TABLE t1 (
AUFNR varchar(12) NOT NULL default '',
+24 −0
Original line number Diff line number Diff line
@@ -722,3 +722,27 @@ WHERE hostname LIKE '%aol%'
    GROUP BY hostname;
hostname	no
cache-dtc-af05.proxy.aol.com	1
drop table if exists t1, t2;
Warnings:
Note	1051	Unknown table 't2'
create table t1 (c1 char(3), c2 char(3));
create table t2 (c3 char(3), c4 char(3));
insert into t1 values ('aaa', 'bb1'), ('aaa', 'bb2');
insert into t2 values ('aaa', 'bb1'), ('aaa', 'bb2');
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
group by c2;
c2
aaa
aaa
Warnings:
Warning	1052	Column 'c2' in group statement is ambiguous
show warnings;
Level	Code	Message
Warning	1052	Column 'c2' in group statement is ambiguous
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
group by t1.c1;
c2
aaa
show warnings;
Level	Code	Message
drop table t1, t2;
+1 −0
Original line number Diff line number Diff line
@@ -304,6 +304,7 @@ s1
0
0
Warnings:
Warning	1052	Column 's1' in group statement is ambiguous
Warning	1052	Column 's1' in having clause is ambiguous
select s1*0 from t1 group by s1 having s1 = 0;
s1*0
+23 −0
Original line number Diff line number Diff line
@@ -539,3 +539,26 @@ SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1
  WHERE hostname LIKE '%aol%'
    GROUP BY hostname;

#
# Bug#11211: Ambiguous column reference in GROUP BY.
#

drop table if exists t1, t2;
create table t1 (c1 char(3), c2 char(3));
create table t2 (c3 char(3), c4 char(3));
insert into t1 values ('aaa', 'bb1'), ('aaa', 'bb2');
insert into t2 values ('aaa', 'bb1'), ('aaa', 'bb2');

# query with ambiguous column reference 'c2'
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
group by c2;

show warnings;

# this query has no ambiguity
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
group by t1.c1;

show warnings;

drop table t1, t2;
Loading