diff options
-rw-r--r-- | mysql-test/r/func_time.result | 167 | ||||
-rw-r--r-- | mysql-test/r/having.result | 9 | ||||
-rw-r--r-- | mysql-test/r/join.result | 88 |
3 files changed, 233 insertions, 31 deletions
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 71fc7e4b90b..c5183ef72c6 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1,222 +1,341 @@ +drop table if exists t1,t2; +select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(date_add(curdate(), interval 1 day))-to_days(curdate()),weekday("1997-11-29"); from_days(to_days("960101")) to_days(960201)-to_days("19960101") to_days(date_add(curdate(), interval 1 day))-to_days(curdate()) weekday("1997-11-29") 1996-01-01 31 1 5 +select period_add("9602",-12),period_diff(199505,"9404") ; period_add("9602",-12) period_diff(199505,"9404") 199502 13 +select now()-now(),weekday(curdate())-weekday(now()),unix_timestamp()-unix_timestamp(now()); now()-now() weekday(curdate())-weekday(now()) unix_timestamp()-unix_timestamp(now()) 0 0 0 +select from_unixtime(unix_timestamp("1994-03-02 10:11:12")),from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s"),from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0; from_unixtime(unix_timestamp("1994-03-02 10:11:12")) from_unixtime(unix_timestamp("1994-03-02 10:11:12"),"%Y-%m-%d %h:%i:%s") from_unixtime(unix_timestamp("1994-03-02 10:11:12"))+0 1994-03-02 10:11:12 1994-03-02 10:11:12 19940302101112 +select sec_to_time(9001),sec_to_time(9001)+0,time_to_sec("15:12:22"), +sec_to_time(time_to_sec("0:30:47")/6.21); sec_to_time(9001) sec_to_time(9001)+0 time_to_sec("15:12:22") sec_to_time(time_to_sec("0:30:47")/6.21) 02:30:01 23001 54742 00:04:57 -sec_to_time(time_to_sec('-838:59:59')) --838:59:59 +select now()-curdate()*1000000-curtime(); now()-curdate()*1000000-curtime() 0 +select strcmp(current_timestamp(),concat(current_date()," ",current_time())); strcmp(current_timestamp(),concat(current_date()," ",current_time())) 0 +select date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w"); date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w") January Thursday 2nd 1997 97 01 02 03 04 05 4 +select date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w")); date_format("1997-01-02", concat("%M %W %D ","%Y %y %m %d %h %i %s %w")) January Thursday 2nd 1997 97 01 02 12 00 00 4 +select dayofmonth("1997-01-02"),dayofmonth(19970323); dayofmonth("1997-01-02") dayofmonth(19970323) 2 23 +select month("1997-01-02"),year("98-02-03"),dayofyear("1997-12-31"); month("1997-01-02") year("98-02-03") dayofyear("1997-12-31") 1 1998 365 +select month("2001-02-00"),year("2001-00-00"); month("2001-02-00") year("2001-00-00") 2 2001 +select DAYOFYEAR("1997-03-03"), WEEK("1998-03-03"), QUARTER(980303); DAYOFYEAR("1997-03-03") WEEK("1998-03-03") QUARTER(980303) 62 9 1 +select HOUR("1997-03-03 23:03:22"), MINUTE("23:03:22"), SECOND(230322); HOUR("1997-03-03 23:03:22") MINUTE("23:03:22") SECOND(230322) 23 3 22 +select week(19980101),week(19970101),week(19980101,1),week(19970101,1); week(19980101) week(19970101) week(19980101,1) week(19970101,1) -0 1 1 1 +0 0 1 1 +select week(19981231),week(19971231),week(19981231,1),week(19971231,1); week(19981231) week(19971231) week(19981231,1) week(19971231,1) -52 53 53 53 +52 52 53 53 +select week(19950101),week(19950101,1); week(19950101) week(19950101,1) 1 0 +select yearweek('1981-12-31',1),yearweek('1982-01-01',1),yearweek('1982-12-31',1),yearweek('1983-01-01',1); yearweek('1981-12-31',1) yearweek('1982-01-01',1) yearweek('1982-12-31',1) yearweek('1983-01-01',1) 198153 198153 198252 198252 +select yearweek('1987-01-01',1),yearweek('1987-01-01'); +yearweek('1987-01-01',1) yearweek('1987-01-01') +198701 198652 +select week("2000-01-01",0) as '2000', week("2001-01-01",0) as '2001', week("2002-01-01",0) as '2002',week("2003-01-01",0) as '2003', week("2004-01-01",0) as '2004', week("2005-01-01",0) as '2005', week("2006-01-01",0) as '2006'; +2000 2001 2002 2003 2004 2005 2006 +0 0 0 0 0 0 1 +select week("2000-01-06",0) as '2000', week("2001-01-06",0) as '2001', week("2002-01-06",0) as '2002',week("2003-01-06",0) as '2003', week("2004-01-06",0) as '2004', week("2005-01-06",0) as '2005', week("2006-01-06",0) as '2006'; +2000 2001 2002 2003 2004 2005 2006 +1 0 1 1 1 1 1 +select week("2000-01-01",1) as '2000', week("2001-01-01",1) as '2001', week("2002-01-01",1) as '2002',week("2003-01-01",1) as '2003', week("2004-01-01",1) as '2004', week("2005-01-01",1) as '2005', week("2006-01-01",1) as '2006'; +2000 2001 2002 2003 2004 2005 2006 +0 1 1 1 1 0 0 +select week("2000-01-06",1) as '2000', week("2001-01-06",1) as '2001', week("2002-01-06",1) as '2002',week("2003-01-06",1) as '2003', week("2004-01-06",1) as '2004', week("2005-01-06",1) as '2005', week("2006-01-06",1) as '2006'; +2000 2001 2002 2003 2004 2005 2006 +1 1 1 2 2 1 1 +select yearweek("2000-01-01",0) as '2000', yearweek("2001-01-01",0) as '2001', yearweek("2002-01-01",0) as '2002',yearweek("2003-01-01",0) as '2003', yearweek("2004-01-01",0) as '2004', yearweek("2005-01-01",0) as '2005', yearweek("2006-01-01",0) as '2006'; +2000 2001 2002 2003 2004 2005 2006 +199952 200053 200152 200252 200352 200452 200601 +select yearweek("2000-01-06",0) as '2000', yearweek("2001-01-06",0) as '2001', yearweek("2002-01-06",0) as '2002',yearweek("2003-01-06",0) as '2003', yearweek("2004-01-06",0) as '2004', yearweek("2005-01-06",0) as '2005', yearweek("2006-01-06",0) as '2006'; +2000 2001 2002 2003 2004 2005 2006 +200001 200053 200201 200301 200401 200501 200601 +select yearweek("2000-01-01",1) as '2000', yearweek("2001-01-01",1) as '2001', yearweek("2002-01-01",1) as '2002',yearweek("2003-01-01",1) as '2003', yearweek("2004-01-01",1) as '2004', yearweek("2005-01-01",1) as '2005', yearweek("2006-01-01",1) as '2006'; +2000 2001 2002 2003 2004 2005 2006 +199952 200101 200201 200301 200401 200453 200552 +select yearweek("2000-01-06",1) as '2000', yearweek("2001-01-06",1) as '2001', yearweek("2002-01-06",1) as '2002',yearweek("2003-01-06",1) as '2003', yearweek("2004-01-06",1) as '2004', yearweek("2005-01-06",1) as '2005', yearweek("2006-01-06",1) as '2006'; +2000 2001 2002 2003 2004 2005 2006 +200001 200101 200201 200302 200402 200501 200601 +select date_format('1998-12-31','%x-%v'),date_format('1999-01-01','%x-%v'); date_format('1998-12-31','%x-%v') date_format('1999-01-01','%x-%v') 1998-53 1998-53 +select date_format('1999-12-31','%x-%v'),date_format('2000-01-01','%x-%v'); date_format('1999-12-31','%x-%v') date_format('2000-01-01','%x-%v') 1999-52 1999-52 -yearweek('1987-01-01',1) yearweek('1987-01-01') -198701 198653 +select dayname("1962-03-03"),dayname("1962-03-03")+0; dayname("1962-03-03") dayname("1962-03-03")+0 Saturday 5 +select monthname("1972-03-04"),monthname("1972-03-04")+0; monthname("1972-03-04") monthname("1972-03-04")+0 March 3 +select time_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T'); time_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T') 00|12|0|12|00|AM|12:00:00 AM|00|00:00:00 +select time_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T'); time_format(19980131010203,'%H|%I|%k|%l|%i|%p|%r|%S|%T') 01|01|1|1|02|AM|01:02:03 AM|03|01:02:03 +select time_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T'); time_format(19980131131415,'%H|%I|%k|%l|%i|%p|%r|%S|%T') 13|01|13|1|14|PM|01:14:15 PM|15|13:14:15 +select time_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T'); time_format(19980131010015,'%H|%I|%k|%l|%i|%p|%r|%S|%T') 01|01|1|1|00|AM|01:00:15 AM|15|01:00:15 +select date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w'); date_format(concat('19980131',131415),'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w') 13|01|13|1|14|PM|01:14:15 PM|15|13:14:15| January|Saturday|31st|1998|98|Sat|Jan|031|01|31|01|15|6 +select date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w'); date_format(19980021000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T| %M|%W|%D|%Y|%y|%a|%b|%j|%m|%d|%h|%s|%w') NULL +select date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND); date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND) 1998-01-01 00:00:00 +select date_add("1997-12-31 23:59:59",INTERVAL 1 MINUTE); date_add("1997-12-31 23:59:59",INTERVAL 1 MINUTE) 1998-01-01 00:00:59 +select date_add("1997-12-31 23:59:59",INTERVAL 1 HOUR); date_add("1997-12-31 23:59:59",INTERVAL 1 HOUR) 1998-01-01 00:59:59 +select date_add("1997-12-31 23:59:59",INTERVAL 1 DAY); date_add("1997-12-31 23:59:59",INTERVAL 1 DAY) 1998-01-01 23:59:59 +select date_add("1997-12-31 23:59:59",INTERVAL 1 MONTH); date_add("1997-12-31 23:59:59",INTERVAL 1 MONTH) 1998-01-31 23:59:59 +select date_add("1997-12-31 23:59:59",INTERVAL 1 YEAR); date_add("1997-12-31 23:59:59",INTERVAL 1 YEAR) 1998-12-31 23:59:59 +select date_add("1997-12-31 23:59:59",INTERVAL "1:1" MINUTE_SECOND); date_add("1997-12-31 23:59:59",INTERVAL "1:1" MINUTE_SECOND) 1998-01-01 00:01:00 +select date_add("1997-12-31 23:59:59",INTERVAL "1:1" HOUR_MINUTE); date_add("1997-12-31 23:59:59",INTERVAL "1:1" HOUR_MINUTE) 1998-01-01 01:00:59 +select date_add("1997-12-31 23:59:59",INTERVAL "1:1" DAY_HOUR); date_add("1997-12-31 23:59:59",INTERVAL "1:1" DAY_HOUR) 1998-01-02 00:59:59 +select date_add("1997-12-31 23:59:59",INTERVAL "1 1" YEAR_MONTH); date_add("1997-12-31 23:59:59",INTERVAL "1 1" YEAR_MONTH) 1999-01-31 23:59:59 +select date_add("1997-12-31 23:59:59",INTERVAL "1:1:1" HOUR_SECOND); date_add("1997-12-31 23:59:59",INTERVAL "1:1:1" HOUR_SECOND) 1998-01-01 01:01:00 +select date_add("1997-12-31 23:59:59",INTERVAL "1 1:1" DAY_MINUTE); date_add("1997-12-31 23:59:59",INTERVAL "1 1:1" DAY_MINUTE) 1998-01-02 01:00:59 +select date_add("1997-12-31 23:59:59",INTERVAL "1 1:1:1" DAY_SECOND); date_add("1997-12-31 23:59:59",INTERVAL "1 1:1:1" DAY_SECOND) 1998-01-02 01:01:00 +select date_sub("1998-01-01 00:00:00",INTERVAL 1 SECOND); date_sub("1998-01-01 00:00:00",INTERVAL 1 SECOND) 1997-12-31 23:59:59 +select date_sub("1998-01-01 00:00:00",INTERVAL 1 MINUTE); date_sub("1998-01-01 00:00:00",INTERVAL 1 MINUTE) 1997-12-31 23:59:00 +select date_sub("1998-01-01 00:00:00",INTERVAL 1 HOUR); date_sub("1998-01-01 00:00:00",INTERVAL 1 HOUR) 1997-12-31 23:00:00 +select date_sub("1998-01-01 00:00:00",INTERVAL 1 DAY); date_sub("1998-01-01 00:00:00",INTERVAL 1 DAY) 1997-12-31 00:00:00 +select date_sub("1998-01-01 00:00:00",INTERVAL 1 MONTH); date_sub("1998-01-01 00:00:00",INTERVAL 1 MONTH) 1997-12-01 00:00:00 +select date_sub("1998-01-01 00:00:00",INTERVAL 1 YEAR); date_sub("1998-01-01 00:00:00",INTERVAL 1 YEAR) 1997-01-01 00:00:00 +select date_sub("1998-01-01 00:00:00",INTERVAL "1:1" MINUTE_SECOND); date_sub("1998-01-01 00:00:00",INTERVAL "1:1" MINUTE_SECOND) 1997-12-31 23:58:59 +select date_sub("1998-01-01 00:00:00",INTERVAL "1:1" HOUR_MINUTE); date_sub("1998-01-01 00:00:00",INTERVAL "1:1" HOUR_MINUTE) 1997-12-31 22:59:00 +select date_sub("1998-01-01 00:00:00",INTERVAL "1:1" DAY_HOUR); date_sub("1998-01-01 00:00:00",INTERVAL "1:1" DAY_HOUR) 1997-12-30 23:00:00 +select date_sub("1998-01-01 00:00:00",INTERVAL "1 1" YEAR_MONTH); date_sub("1998-01-01 00:00:00",INTERVAL "1 1" YEAR_MONTH) 1996-12-01 00:00:00 +select date_sub("1998-01-01 00:00:00",INTERVAL "1:1:1" HOUR_SECOND); date_sub("1998-01-01 00:00:00",INTERVAL "1:1:1" HOUR_SECOND) 1997-12-31 22:58:59 +select date_sub("1998-01-01 00:00:00",INTERVAL "1 1:1" DAY_MINUTE); date_sub("1998-01-01 00:00:00",INTERVAL "1 1:1" DAY_MINUTE) 1997-12-30 22:59:00 +select date_sub("1998-01-01 00:00:00",INTERVAL "1 1:1:1" DAY_SECOND); date_sub("1998-01-01 00:00:00",INTERVAL "1 1:1:1" DAY_SECOND) 1997-12-30 22:58:59 +select date_add("1997-12-31 23:59:59",INTERVAL 100000 SECOND); date_add("1997-12-31 23:59:59",INTERVAL 100000 SECOND) 1998-01-02 03:46:39 +select date_add("1997-12-31 23:59:59",INTERVAL -100000 MINUTE); date_add("1997-12-31 23:59:59",INTERVAL -100000 MINUTE) 1997-10-23 13:19:59 +select date_add("1997-12-31 23:59:59",INTERVAL 100000 HOUR); date_add("1997-12-31 23:59:59",INTERVAL 100000 HOUR) 2009-05-29 15:59:59 +select date_add("1997-12-31 23:59:59",INTERVAL -100000 DAY); date_add("1997-12-31 23:59:59",INTERVAL -100000 DAY) 1724-03-17 23:59:59 +select date_add("1997-12-31 23:59:59",INTERVAL 100000 MONTH); date_add("1997-12-31 23:59:59",INTERVAL 100000 MONTH) NULL +select date_add("1997-12-31 23:59:59",INTERVAL -100000 YEAR); date_add("1997-12-31 23:59:59",INTERVAL -100000 YEAR) NULL +select date_add("1997-12-31 23:59:59",INTERVAL "10000:1" MINUTE_SECOND); date_add("1997-12-31 23:59:59",INTERVAL "10000:1" MINUTE_SECOND) 1998-01-07 22:40:00 +select date_add("1997-12-31 23:59:59",INTERVAL "-10000:1" HOUR_MINUTE); date_add("1997-12-31 23:59:59",INTERVAL "-10000:1" HOUR_MINUTE) 1996-11-10 07:58:59 +select date_add("1997-12-31 23:59:59",INTERVAL "10000:1" DAY_HOUR); date_add("1997-12-31 23:59:59",INTERVAL "10000:1" DAY_HOUR) 2025-05-19 00:59:59 +select date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH); date_add("1997-12-31 23:59:59",INTERVAL "-100 1" YEAR_MONTH) 1897-11-30 23:59:59 +select date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND); date_add("1997-12-31 23:59:59",INTERVAL "10000:99:99" HOUR_SECOND) 1999-02-21 17:40:38 +select date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE); date_add("1997-12-31 23:59:59",INTERVAL " -10000 99:99" DAY_MINUTE) 1970-08-11 19:20:59 +select date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND); date_add("1997-12-31 23:59:59",INTERVAL "10000 99:99:99" DAY_SECOND) 2025-05-23 04:40:38 +select "1997-12-31 23:59:59" + INTERVAL 1 SECOND; "1997-12-31 23:59:59" + INTERVAL 1 SECOND 1998-01-01 00:00:00 +select INTERVAL 1 DAY + "1997-12-31"; INTERVAL 1 DAY + "1997-12-31" 1998-01-01 +select "1998-01-01 00:00:00" - INTERVAL 1 SECOND; "1998-01-01 00:00:00" - INTERVAL 1 SECOND 1997-12-31 23:59:59 +select date_sub("1998-01-02",INTERVAL 31 DAY); date_sub("1998-01-02",INTERVAL 31 DAY) 1997-12-02 +select date_add("1997-12-31",INTERVAL 1 SECOND); date_add("1997-12-31",INTERVAL 1 SECOND) 1997-12-31 00:00:01 +select date_add("1997-12-31",INTERVAL 1 DAY); date_add("1997-12-31",INTERVAL 1 DAY) 1998-01-01 +select date_add(NULL,INTERVAL 100000 SECOND); date_add(NULL,INTERVAL 100000 SECOND) NULL +select date_add("1997-12-31 23:59:59",INTERVAL NULL SECOND); date_add("1997-12-31 23:59:59",INTERVAL NULL SECOND) NULL +select date_add("1997-12-31 23:59:59",INTERVAL NULL MINUTE_SECOND); date_add("1997-12-31 23:59:59",INTERVAL NULL MINUTE_SECOND) NULL +select date_add("9999-12-31 23:59:59",INTERVAL 1 SECOND); date_add("9999-12-31 23:59:59",INTERVAL 1 SECOND) NULL +select date_sub("0000-00-00 00:00:00",INTERVAL 1 SECOND); date_sub("0000-00-00 00:00:00",INTERVAL 1 SECOND) NULL +select date_add('1998-01-30',Interval 1 month); date_add('1998-01-30',Interval 1 month) 1998-02-28 +select date_add('1998-01-30',Interval '2:1' year_month); date_add('1998-01-30',Interval '2:1' year_month) 2000-02-29 +select date_add('1996-02-29',Interval '1' year); date_add('1996-02-29',Interval '1' year) 1997-02-28 +select extract(YEAR FROM "1999-01-02 10:11:12"); extract(YEAR FROM "1999-01-02 10:11:12") 1999 +select extract(YEAR_MONTH FROM "1999-01-02"); extract(YEAR_MONTH FROM "1999-01-02") 199901 +select extract(DAY FROM "1999-01-02"); extract(DAY FROM "1999-01-02") 2 +select extract(DAY_HOUR FROM "1999-01-02 10:11:12"); extract(DAY_HOUR FROM "1999-01-02 10:11:12") 210 +select extract(DAY_MINUTE FROM "02 10:11:12"); extract(DAY_MINUTE FROM "02 10:11:12") 21011 +select extract(DAY_SECOND FROM "225 10:11:12"); extract(DAY_SECOND FROM "225 10:11:12") 225101112 +select extract(HOUR FROM "1999-01-02 10:11:12"); extract(HOUR FROM "1999-01-02 10:11:12") 10 +select extract(HOUR_MINUTE FROM "10:11:12"); extract(HOUR_MINUTE FROM "10:11:12") 1011 +select extract(HOUR_SECOND FROM "10:11:12"); extract(HOUR_SECOND FROM "10:11:12") 101112 +select extract(MINUTE FROM "10:11:12"); extract(MINUTE FROM "10:11:12") 11 +select extract(MINUTE_SECOND FROM "10:11:12"); extract(MINUTE_SECOND FROM "10:11:12") 1112 +select extract(SECOND FROM "1999-01-02 10:11:12"); extract(SECOND FROM "1999-01-02 10:11:12") 12 +select extract(MONTH FROM "2001-02-00"); extract(MONTH FROM "2001-02-00") 2 +create table t1 (ctime varchar(20)); +insert into t1 values ('2001-01-12 12:23:40'); +select ctime, hour(ctime) from t1; ctime hour(ctime) 2001-01-12 12:23:40 12 +drop table t1; +create table t1 (id int); +create table t2 (id int, date date); +insert into t1 values (1); +insert into t2 values (1, "0000-00-00"); +insert into t1 values (2); +insert into t2 values (2, "2000-01-01"); +select monthname(date) from t1 inner join t2 on t1.id = t2.id; monthname(date) NULL January +select monthname(date) from t1 inner join t2 on t1.id = t2.id order by t1.id; monthname(date) NULL January +drop table t1,t2; +CREATE TABLE t1 (updated text) TYPE=MyISAM; +INSERT INTO t1 VALUES (''); +SELECT month(updated) from t1; month(updated) NULL +SELECT year(updated) from t1; year(updated) NULL -dayofyear("0000-00-00") dayofyear(d) dayofyear(dt) dayofyear(t) dayofyear(c) -NULL NULL NULL NULL NULL -dayofmonth("0000-00-00") dayofmonth(d) dayofmonth(dt) dayofmonth(t) dayofmonth(c) -0 0 0 0 0 -month("0000-00-00") month(d) month(dt) month(t) month(c) -0 0 0 0 0 -quarter("0000-00-00") quarter(d) quarter(dt) quarter(t) quarter(c) -0 0 0 0 0 -week("0000-00-00") week(d) week(dt) week(t) week(c) -NULL NULL NULL NULL NULL -year("0000-00-00") year(d) year(dt) year(t) year(c) -0 0 0 0 0 -yearweek("0000-00-00") yearweek(d) yearweek(dt) yearweek(t) yearweek(c) -NULL NULL NULL NULL NULL -to_days("0000-00-00") to_days(d) to_days(dt) to_days(t) to_days(c) -NULL NULL NULL NULL NULL -extract(MONTH FROM "0000-00-00") extract(MONTH FROM d) extract(MONTH FROM dt) extract(MONTH FROM t) extract(MONTH FROM c) -0 0 0 0 0 +drop table t1; diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index 69943c505f0..229604034d8 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -1,6 +1,11 @@ +drop table if exists t1; +create table t1 (a int); +select count(a) as b from t1 where a=0 having b > 0; b +insert into t1 values (null); +select count(a) as b from t1 where a=0 having b > 0; b +select count(a) as b from t1 where a=0 having b >=0; b 0 -id start end chr_strand -133197 813898 813898 -1.0000 +drop table t1; diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index e48c209fed6..828c769fdcd 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -1,29 +1,107 @@ +drop table if exists t1,t2; +create table t1 (id int primary key); +create table t2 (id int); +insert into t1 values (75); +insert into t1 values (79); +insert into t1 values (78); +insert into t1 values (77); +replace into t1 values (76); +replace into t1 values (76); +insert into t1 values (104); +insert into t1 values (103); +insert into t1 values (102); +insert into t1 values (101); +insert into t1 values (105); +insert into t1 values (106); +insert into t1 values (107); +insert into t2 values (107); +insert into t2 values (75); +select t1.id, t2.id from t1, t2 where t2.id = t1.id; id id 107 107 75 75 +select t1.id, count(t2.id) from t1,t2 where t2.id = t1.id group by t1.id; id count(t2.id) 75 1 107 1 +select t1.id, count(t2.id) from t1,t2 where t2.id = t1.id group by t2.id; id count(t2.id) 75 1 107 1 +drop table t1,t2; +CREATE TABLE t1 ( +id int(11) NOT NULL auto_increment, +token varchar(100) DEFAULT '' NOT NULL, +count int(11) DEFAULT '0' NOT NULL, +qty int(11), +phone char(1) DEFAULT '' NOT NULL, +timestamp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, +PRIMARY KEY (id), +KEY token (token(15)), +KEY timestamp (timestamp), +UNIQUE token_2 (token(75),count,phone) +); +INSERT INTO t1 VALUES (21,'e45703b64de71482360de8fec94c3ade',3,7800,'n','1999-12-23 17:22:21'); +INSERT INTO t1 VALUES (22,'e45703b64de71482360de8fec94c3ade',4,5000,'y','1999-12-23 17:22:21'); +INSERT INTO t1 VALUES (18,'346d1cb63c89285b2351f0ca4de40eda',3,13200,'b','1999-12-23 11:58:04'); +INSERT INTO t1 VALUES (17,'ca6ddeb689e1b48a04146b1b5b6f936a',4,15000,'b','1999-12-23 11:36:53'); +INSERT INTO t1 VALUES (16,'ca6ddeb689e1b48a04146b1b5b6f936a',3,13200,'b','1999-12-23 11:36:53'); +INSERT INTO t1 VALUES (26,'a71250b7ed780f6ef3185bfffe027983',5,1500,'b','1999-12-27 09:44:24'); +INSERT INTO t1 VALUES (24,'4d75906f3c37ecff478a1eb56637aa09',3,5400,'y','1999-12-23 17:29:12'); +INSERT INTO t1 VALUES (25,'4d75906f3c37ecff478a1eb56637aa09',4,6500,'y','1999-12-23 17:29:12'); +INSERT INTO t1 VALUES (27,'a71250b7ed780f6ef3185bfffe027983',3,6200,'b','1999-12-27 09:44:24'); +INSERT INTO t1 VALUES (28,'a71250b7ed780f6ef3185bfffe027983',3,5400,'y','1999-12-27 09:44:36'); +INSERT INTO t1 VALUES (29,'a71250b7ed780f6ef3185bfffe027983',4,17700,'b','1999-12-27 09:45:05'); +CREATE TABLE t2 ( +id int(11) NOT NULL auto_increment, +category int(11) DEFAULT '0' NOT NULL, +county int(11) DEFAULT '0' NOT NULL, +state int(11) DEFAULT '0' NOT NULL, +phones int(11) DEFAULT '0' NOT NULL, +nophones int(11) DEFAULT '0' NOT NULL, +PRIMARY KEY (id), +KEY category (category,county,state) +); +INSERT INTO t2 VALUES (3,2,11,12,5400,7800); +INSERT INTO t2 VALUES (4,2,25,12,6500,11200); +INSERT INTO t2 VALUES (5,1,37,6,10000,12000); +select a.id, b.category as catid, b.state as stateid, b.county as +countyid from t1 a, t2 b where (a.token = +'a71250b7ed780f6ef3185bfffe027983') and (a.count = b.id); id catid stateid countyid 27 2 12 11 28 2 12 11 29 2 12 25 26 1 6 37 +select a.id, b.category as catid, b.state as stateid, b.county as +countyid from t1 a, t2 b where (a.token = +'a71250b7ed780f6ef3185bfffe027983') and (a.count = b.id) order by a.id; id catid stateid countyid 26 1 6 37 27 2 12 11 28 2 12 11 29 2 12 25 +drop table t1, t2; +create table t1 (a int primary key); +insert into t1 values(1),(2); +select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a); a 1 2 +select t1.a from t1 as t1 left join t1 as t2 using (a) left join t1 as t3 using (a) left join t1 as t4 using (a) left join t1 as t5 using (a) left join t1 as t6 using (a) left join t1 as t7 using (a) left join t1 as t8 using (a) left join t1 as t9 using (a) left join t1 as t10 using (a) left join t1 as t11 using (a) left join t1 as t12 using (a) left join t1 as t13 using (a) left join t1 as t14 using (a) left join t1 as t15 using (a) left join t1 as t16 using (a) left join t1 as t17 using (a) left join t1 as t18 using (a) left join t1 as t19 using (a) left join t1 as t20 using (a) left join t1 as t21 using (a) left join t1 as t22 using (a) left join t1 as t23 using (a) left join t1 as t24 using (a) left join t1 as t25 using (a) left join t1 as t26 using (a) left join t1 as t27 using (a) left join t1 as t28 using (a) left join t1 as t29 using (a) left join t1 as t30 using (a) left join t1 as t31 using (a) left join t1 as t32 using (a) left join t1 as t33 using (a) left join t1 as t34 using (a) left join t1 as t35 using (a) left join t1 as t36 using (a) left join t1 as t37 using (a) left join t1 as t38 using (a) left join t1 as t39 using (a) left join t1 as t40 using (a) left join t1 as t41 using (a) left join t1 as t42 using (a) left join t1 as t43 using (a) left join t1 as t44 using (a) left join t1 as t45 using (a) left join t1 as t46 using (a) left join t1 as t47 using (a) left join t1 as t48 using (a) left join t1 as t49 using (a) left join t1 as t50 using (a) left join t1 as t51 using (a) left join t1 as t52 using (a) left join t1 as t53 using (a) left join t1 as t54 using (a) left join t1 as t55 using (a) left join t1 as t56 using (a) left join t1 as t57 using (a) left join t1 as t58 using (a) left join t1 as t59 using (a) left join t1 as t60 using (a) left join t1 as t61 using (a) left join t1 as t62 using (a) left join t1 as t63 using (a) left join t1 as t64 using (a) left join t1 as t65 using (a); +Too many tables. MySQL can only use $MAX_TABLES tables in a join +drop table t1; +CREATE TABLE t1 ( +a int(11) NOT NULL, +b int(11) NOT NULL, +PRIMARY KEY (a,b) +) TYPE=MyISAM; +INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(2,3); +CREATE TABLE t2 ( +a int(11) default NULL +) TYPE=MyISAM; +INSERT INTO t2 VALUES (2),(3); +SELECT t1.a,t2.a,b FROM t1,t2 WHERE t1.a=t2.a AND (t1.a=1 OR t1.a=2) AND b>=1 AND b<=3; a a b 2 2 3 -d d -2001-08-01 NULL -0000-00-00 NULL -d -0000-00-00 +DROP TABLE t1, t2; |