10
10
grp int default NULL,
11
a bigint unsigned default NULL,
11
a bigint default NULL,
12
12
c char(10) NOT NULL default ''
14
14
INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b'),(2,3,'c'),(3,4,'E'),(3,5,'C'),(3,6,'D'),(NULL,NULL,'');
15
create table t2 (id int, a bigint unsigned not null, c char(10), d int, primary key (a));
15
create table t2 (id int, a bigint not null, c char(10), d int, primary key (a));
16
16
insert into t2 values (1,1,"a",1),(3,4,"A",4),(3,5,"B",5),(3,6,"C",6),(4,7,"D",7);
18
18
select t1.*,t2.* from t1 JOIN t2 where t1.a=t2.a;
58
usr_id INT unsigned NOT NULL,
59
uniq_id INT unsigned NOT NULL AUTO_INCREMENT,
60
start_num INT unsigned NOT NULL DEFAULT 1,
61
increment INT unsigned NOT NULL DEFAULT 1,
59
uniq_id INT NOT NULL AUTO_INCREMENT,
60
start_num INT NOT NULL DEFAULT 1,
61
increment INT NOT NULL DEFAULT 1,
62
62
PRIMARY KEY (uniq_id),
63
63
INDEX usr_uniq_idx (usr_id, uniq_id),
64
64
INDEX uniq_usr_idx (uniq_id, usr_id)
67
id INT unsigned NOT NULL DEFAULT 0,
68
usr2_id INT unsigned NOT NULL DEFAULT 0,
69
max INT unsigned NOT NULL DEFAULT 0,
70
c_amount INT unsigned NOT NULL DEFAULT 0,
71
d_max INT unsigned NOT NULL DEFAULT 0,
72
d_num INT unsigned NOT NULL DEFAULT 0,
73
orig_time INT unsigned NOT NULL DEFAULT 0,
74
c_time INT unsigned NOT NULL DEFAULT 0,
67
id INT NOT NULL DEFAULT 0,
68
usr2_id INT NOT NULL DEFAULT 0,
69
max INT NOT NULL DEFAULT 0,
70
c_amount INT NOT NULL DEFAULT 0,
71
d_max INT NOT NULL DEFAULT 0,
72
d_num INT NOT NULL DEFAULT 0,
73
orig_time INT NOT NULL DEFAULT 0,
74
c_time INT NOT NULL DEFAULT 0,
75
75
active ENUM ("no","yes") NOT NULL,
76
76
PRIMARY KEY (id,usr2_id),
224
224
INSERT INTO t1 VALUES (3,'Thimble Smith');
226
226
CREATE TABLE t2 (
227
id int unsigned NOT NULL auto_increment,
228
owner int unsigned DEFAULT '0' NOT NULL,
227
id int NOT NULL auto_increment,
228
owner int DEFAULT '0' NOT NULL,
415
415
# Test problem with LEFT JOIN
417
create table t1 (fooID int unsigned auto_increment, primary key (fooID));
418
create table t2 (fooID int unsigned not null, barID int unsigned not null, primary key (fooID,barID));
417
create table t1 (fooID int auto_increment, primary key (fooID));
418
create table t2 (fooID int not null, barID int not null, primary key (fooID,barID));
419
419
insert into t1 (fooID) values (10),(20),(30);
420
420
insert into t2 values (10,1),(20,2),(30,3);
421
421
explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
476
476
# Test for BUG#5088
478
478
create table t1 (
479
match_id int unsigned not null auto_increment,
480
home int unsigned default '0',
479
match_id int not null auto_increment,
480
home int default '0',
481
481
unique key match_id (match_id),
482
482
key match_id_2 (match_id)
485
485
insert into t1 values("1", "2");
487
487
create table t2 (
488
player_id int unsigned default '0',
489
match_1_h int unsigned default '0',
488
player_id int default '0',
489
match_1_h int default '0',
490
490
key player_id (player_id)
670
670
# BUG#10162 - ON is merged with WHERE, left join is convered to a regular join
672
create table t1 (gid int unsigned not null, x int not null, y int not null, art int not null, primary key (gid,x,y));
672
create table t1 (gid int not null, x int not null, y int not null, art int not null, primary key (gid,x,y));
673
673
insert t1 values (1, -5, -8, 2), (1, 2, 2, 1), (1, 1, 1, 1);
674
create table t2 (gid int unsigned not null, x int not null, y int not null, id int not null, primary key (gid,id,x,y), key id (id));
674
create table t2 (gid int not null, x int not null, y int not null, id int not null, primary key (gid,id,x,y), key id (id));
675
675
insert t2 values (1, -5, -8, 1), (1, 1, 1, 1), (1, 2, 2, 1);
676
create table t3 ( set_id int unsigned not null, id int unsigned not null, name char(12) not null, primary key (id,set_id));
676
create table t3 ( set_id int not null, id int not null, name char(12) not null, primary key (id,set_id));
677
677
insert t3 values (0, 1, 'a'), (1, 1, 'b'), (0, 2, 'c'), (1, 2, 'd'), (1, 3, 'e'), (1, 4, 'f'), (1, 5, 'g'), (1, 6, 'h');
678
678
explain select name from t1 left join t2 on t1.x = t2.x and t1.y = t2.y
679
679
left join t3 on t1.art = t3.id where t2.id =1 and t2.x = -5 and t2.y =-8