1625
1625
select t2.fld4,t2.fld1,count(price),sum(price),min(price),max(price),avg(price) from t3,t2 where t3.companynr = 37 and t2.fld1 = t3.t2nr group by fld1,t2.fld4;
1626
1626
fld4 fld1 count(price) sum(price) min(price) max(price) avg(price)
1627
teethe 000001 1 5987435 5987435 5987435 5987435.0000
1628
dreaded 011401 1 5987435 5987435 5987435 5987435.0000
1629
scholastics 011402 1 28357832 28357832 28357832 28357832.0000
1630
audiology 011403 1 39654943 39654943 39654943 39654943.0000
1631
wallet 011501 1 5987435 5987435 5987435 5987435.0000
1632
parters 011701 1 5987435 5987435 5987435 5987435.0000
1633
eschew 011702 1 28357832 28357832 28357832 28357832.0000
1634
quitter 011703 1 39654943 39654943 39654943 39654943.0000
1635
neat 012001 1 5987435 5987435 5987435 5987435.0000
1636
Steinberg 012003 1 39654943 39654943 39654943 39654943.0000
1637
balled 012301 1 5987435 5987435 5987435 5987435.0000
1638
persist 012302 1 28357832 28357832 28357832 28357832.0000
1639
attainments 012303 1 39654943 39654943 39654943 39654943.0000
1640
capably 012501 1 5987435 5987435 5987435 5987435.0000
1641
impulsive 012602 1 28357832 28357832 28357832 28357832.0000
1642
starlet 012603 1 39654943 39654943 39654943 39654943.0000
1643
featherweight 012701 1 5987435 5987435 5987435 5987435.0000
1644
pessimist 012702 1 28357832 28357832 28357832 28357832.0000
1645
daughter 012703 1 39654943 39654943 39654943 39654943.0000
1646
lawgiver 013601 1 5987435 5987435 5987435 5987435.0000
1647
stated 013602 1 28357832 28357832 28357832 28357832.0000
1648
readable 013603 1 39654943 39654943 39654943 39654943.0000
1649
testicle 013801 1 5987435 5987435 5987435 5987435.0000
1650
Parsifal 013802 1 28357832 28357832 28357832 28357832.0000
1651
leavings 013803 1 39654943 39654943 39654943 39654943.0000
1652
squeaking 013901 1 5987435 5987435 5987435 5987435.0000
1653
contrasted 016001 1 5987435 5987435 5987435 5987435.0000
1654
leftover 016201 1 5987435 5987435 5987435 5987435.0000
1655
whiteners 016202 1 28357832 28357832 28357832 28357832.0000
1656
erases 016301 1 5987435 5987435 5987435 5987435.0000
1657
Punjab 016302 1 28357832 28357832 28357832 28357832.0000
1658
Merritt 016303 1 39654943 39654943 39654943 39654943.0000
1659
sweetish 018001 1 5987435 5987435 5987435 5987435.0000
1660
dogging 018002 1 28357832 28357832 28357832 28357832.0000
1661
scornfully 018003 1 39654943 39654943 39654943 39654943.0000
1662
fetters 018012 1 28357832 28357832 28357832 28357832.0000
1663
bivalves 018013 1 39654943 39654943 39654943 39654943.0000
1664
skulking 018021 1 5987435 5987435 5987435 5987435.0000
1665
flint 018022 1 28357832 28357832 28357832 28357832.0000
1666
flopping 018023 1 39654943 39654943 39654943 39654943.0000
1667
Judas 018032 1 28357832 28357832 28357832 28357832.0000
1668
vacuuming 018033 1 39654943 39654943 39654943 39654943.0000
1669
medical 018041 1 5987435 5987435 5987435 5987435.0000
1670
bloodbath 018042 1 28357832 28357832 28357832 28357832.0000
1671
subschema 018043 1 39654943 39654943 39654943 39654943.0000
1672
interdependent 018051 1 5987435 5987435 5987435 5987435.0000
1673
Graves 018052 1 28357832 28357832 28357832 28357832.0000
1674
neonatal 018053 1 39654943 39654943 39654943 39654943.0000
1675
sorters 018061 1 5987435 5987435 5987435 5987435.0000
1676
epistle 018062 1 28357832 28357832 28357832 28357832.0000
1677
Conley 018101 1 5987435 5987435 5987435 5987435.0000
1678
lectured 018102 1 28357832 28357832 28357832 28357832.0000
1679
Abraham 018103 1 39654943 39654943 39654943 39654943.0000
1680
cage 018201 1 5987435 5987435 5987435 5987435.0000
1681
hushes 018202 1 28357832 28357832 28357832 28357832.0000
1682
Simla 018402 1 28357832 28357832 28357832 28357832.0000
1683
reporters 018403 1 39654943 39654943 39654943 39654943.0000
1684
coexist 018601 1 5987435 5987435 5987435 5987435.0000
1685
Beebe 018602 1 28357832 28357832 28357832 28357832.0000
1686
Taoism 018603 1 39654943 39654943 39654943 39654943.0000
1687
Connally 018801 1 5987435 5987435 5987435 5987435.0000
1688
fetched 018802 1 28357832 28357832 28357832 28357832.0000
1689
checkpoints 018803 1 39654943 39654943 39654943 39654943.0000
1690
gritty 018811 1 5987435 5987435 5987435 5987435.0000
1691
firearm 018812 1 28357832 28357832 28357832 28357832.0000
1692
minima 019101 1 5987435 5987435 5987435 5987435.0000
1693
Selfridge 019102 1 28357832 28357832 28357832 28357832.0000
1694
disable 019103 1 39654943 39654943 39654943 39654943.0000
1695
witchcraft 019201 1 5987435 5987435 5987435 5987435.0000
1696
betroth 030501 1 5987435 5987435 5987435 5987435.0000
1697
Manhattanize 030502 1 28357832 28357832 28357832 28357832.0000
1698
imprint 030503 1 39654943 39654943 39654943 39654943.0000
1699
swelling 031901 1 5987435 5987435 5987435 5987435.0000
1700
interrelationships 036001 1 5987435 5987435 5987435 5987435.0000
1701
riser 036002 1 28357832 28357832 28357832 28357832.0000
1702
bee 038001 1 5987435 5987435 5987435 5987435.0000
1703
kanji 038002 1 28357832 28357832 28357832 28357832.0000
1704
dental 038003 1 39654943 39654943 39654943 39654943.0000
1705
railway 038011 1 5987435 5987435 5987435 5987435.0000
1706
validate 038012 1 28357832 28357832 28357832 28357832.0000
1707
normalizes 038013 1 39654943 39654943 39654943 39654943.0000
1708
Kline 038101 1 5987435 5987435 5987435 5987435.0000
1709
Anatole 038102 1 28357832 28357832 28357832 28357832.0000
1710
partridges 038103 1 39654943 39654943 39654943 39654943.0000
1711
recruited 038201 1 5987435 5987435 5987435 5987435.0000
1712
dimensions 038202 1 28357832 28357832 28357832 28357832.0000
1713
Chicana 038203 1 39654943 39654943 39654943 39654943.0000
1627
teethe 1 1 5987435 5987435 5987435 5987435.0000
1628
dreaded 11401 1 5987435 5987435 5987435 5987435.0000
1629
scholastics 11402 1 28357832 28357832 28357832 28357832.0000
1630
audiology 11403 1 39654943 39654943 39654943 39654943.0000
1631
wallet 11501 1 5987435 5987435 5987435 5987435.0000
1632
parters 11701 1 5987435 5987435 5987435 5987435.0000
1633
eschew 11702 1 28357832 28357832 28357832 28357832.0000
1634
quitter 11703 1 39654943 39654943 39654943 39654943.0000
1635
neat 12001 1 5987435 5987435 5987435 5987435.0000
1636
Steinberg 12003 1 39654943 39654943 39654943 39654943.0000
1637
balled 12301 1 5987435 5987435 5987435 5987435.0000
1638
persist 12302 1 28357832 28357832 28357832 28357832.0000
1639
attainments 12303 1 39654943 39654943 39654943 39654943.0000
1640
capably 12501 1 5987435 5987435 5987435 5987435.0000
1641
impulsive 12602 1 28357832 28357832 28357832 28357832.0000
1642
starlet 12603 1 39654943 39654943 39654943 39654943.0000
1643
featherweight 12701 1 5987435 5987435 5987435 5987435.0000
1644
pessimist 12702 1 28357832 28357832 28357832 28357832.0000
1645
daughter 12703 1 39654943 39654943 39654943 39654943.0000
1646
lawgiver 13601 1 5987435 5987435 5987435 5987435.0000
1647
stated 13602 1 28357832 28357832 28357832 28357832.0000
1648
readable 13603 1 39654943 39654943 39654943 39654943.0000
1649
testicle 13801 1 5987435 5987435 5987435 5987435.0000
1650
Parsifal 13802 1 28357832 28357832 28357832 28357832.0000
1651
leavings 13803 1 39654943 39654943 39654943 39654943.0000
1652
squeaking 13901 1 5987435 5987435 5987435 5987435.0000
1653
contrasted 16001 1 5987435 5987435 5987435 5987435.0000
1654
leftover 16201 1 5987435 5987435 5987435 5987435.0000
1655
whiteners 16202 1 28357832 28357832 28357832 28357832.0000
1656
erases 16301 1 5987435 5987435 5987435 5987435.0000
1657
Punjab 16302 1 28357832 28357832 28357832 28357832.0000
1658
Merritt 16303 1 39654943 39654943 39654943 39654943.0000
1659
sweetish 18001 1 5987435 5987435 5987435 5987435.0000
1660
dogging 18002 1 28357832 28357832 28357832 28357832.0000
1661
scornfully 18003 1 39654943 39654943 39654943 39654943.0000
1662
fetters 18012 1 28357832 28357832 28357832 28357832.0000
1663
bivalves 18013 1 39654943 39654943 39654943 39654943.0000
1664
skulking 18021 1 5987435 5987435 5987435 5987435.0000
1665
flint 18022 1 28357832 28357832 28357832 28357832.0000
1666
flopping 18023 1 39654943 39654943 39654943 39654943.0000
1667
Judas 18032 1 28357832 28357832 28357832 28357832.0000
1668
vacuuming 18033 1 39654943 39654943 39654943 39654943.0000
1669
medical 18041 1 5987435 5987435 5987435 5987435.0000
1670
bloodbath 18042 1 28357832 28357832 28357832 28357832.0000
1671
subschema 18043 1 39654943 39654943 39654943 39654943.0000
1672
interdependent 18051 1 5987435 5987435 5987435 5987435.0000
1673
Graves 18052 1 28357832 28357832 28357832 28357832.0000
1674
neonatal 18053 1 39654943 39654943 39654943 39654943.0000
1675
sorters 18061 1 5987435 5987435 5987435 5987435.0000
1676
epistle 18062 1 28357832 28357832 28357832 28357832.0000
1677
Conley 18101 1 5987435 5987435 5987435 5987435.0000
1678
lectured 18102 1 28357832 28357832 28357832 28357832.0000
1679
Abraham 18103 1 39654943 39654943 39654943 39654943.0000
1680
cage 18201 1 5987435 5987435 5987435 5987435.0000
1681
hushes 18202 1 28357832 28357832 28357832 28357832.0000
1682
Simla 18402 1 28357832 28357832 28357832 28357832.0000
1683
reporters 18403 1 39654943 39654943 39654943 39654943.0000
1684
coexist 18601 1 5987435 5987435 5987435 5987435.0000
1685
Beebe 18602 1 28357832 28357832 28357832 28357832.0000
1686
Taoism 18603 1 39654943 39654943 39654943 39654943.0000
1687
Connally 18801 1 5987435 5987435 5987435 5987435.0000
1688
fetched 18802 1 28357832 28357832 28357832 28357832.0000
1689
checkpoints 18803 1 39654943 39654943 39654943 39654943.0000
1690
gritty 18811 1 5987435 5987435 5987435 5987435.0000
1691
firearm 18812 1 28357832 28357832 28357832 28357832.0000
1692
minima 19101 1 5987435 5987435 5987435 5987435.0000
1693
Selfridge 19102 1 28357832 28357832 28357832 28357832.0000
1694
disable 19103 1 39654943 39654943 39654943 39654943.0000
1695
witchcraft 19201 1 5987435 5987435 5987435 5987435.0000
1696
betroth 30501 1 5987435 5987435 5987435 5987435.0000
1697
Manhattanize 30502 1 28357832 28357832 28357832 28357832.0000
1698
imprint 30503 1 39654943 39654943 39654943 39654943.0000
1699
swelling 31901 1 5987435 5987435 5987435 5987435.0000
1700
interrelationships 36001 1 5987435 5987435 5987435 5987435.0000
1701
riser 36002 1 28357832 28357832 28357832 28357832.0000
1702
bee 38001 1 5987435 5987435 5987435 5987435.0000
1703
kanji 38002 1 28357832 28357832 28357832 28357832.0000
1704
dental 38003 1 39654943 39654943 39654943 39654943.0000
1705
railway 38011 1 5987435 5987435 5987435 5987435.0000
1706
validate 38012 1 28357832 28357832 28357832 28357832.0000
1707
normalizes 38013 1 39654943 39654943 39654943 39654943.0000
1708
Kline 38101 1 5987435 5987435 5987435 5987435.0000
1709
Anatole 38102 1 28357832 28357832 28357832 28357832.0000
1710
partridges 38103 1 39654943 39654943 39654943 39654943.0000
1711
recruited 38201 1 5987435 5987435 5987435 5987435.0000
1712
dimensions 38202 1 28357832 28357832 28357832 28357832.0000
1713
Chicana 38203 1 39654943 39654943 39654943 39654943.0000
1714
1714
select t3.companynr,fld3,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr = 512 group by companynr,fld3;
1715
1715
companynr fld3 sum(price)
1716
1716
512 boat 786542
1940
1940
Tables_in_test (t?)
1941
1941
show full columns from t2;
1942
1942
Field Type Collation Null Key Default Extra Privileges Comment
1943
auto int(11) NULL NO PRI NULL auto_increment #
1944
fld1 int(6) unsigned zerofill NULL NO UNI NULL #
1945
companynr tinyint(2) unsigned zerofill NULL NO NULL #
1946
fld3 char(30) latin1_swedish_ci NO MUL NULL #
1947
fld4 char(35) latin1_swedish_ci NO NULL #
1948
fld5 char(35) latin1_swedish_ci NO NULL #
1949
fld6 char(4) latin1_swedish_ci NO NULL #
1943
auto int NULL NO PRI NULL auto_increment #
1944
fld1 int unsigned NULL NO UNI NULL #
1945
companynr tinyint(3) unsigned NULL NO NULL #
1946
fld3 varchar(30) latin1_swedish_ci NO MUL NULL #
1947
fld4 varchar(35) latin1_swedish_ci NO NULL #
1948
fld5 varchar(35) latin1_swedish_ci NO NULL #
1949
fld6 varchar(4) latin1_swedish_ci NO NULL #
1950
1950
show full columns from t2 from test like 'f%';
1951
1951
Field Type Collation Null Key Default Extra Privileges Comment
1952
fld1 int(6) unsigned zerofill NULL NO UNI NULL #
1953
fld3 char(30) latin1_swedish_ci NO MUL NULL #
1954
fld4 char(35) latin1_swedish_ci NO NULL #
1955
fld5 char(35) latin1_swedish_ci NO NULL #
1956
fld6 char(4) latin1_swedish_ci NO NULL #
1952
fld1 int unsigned NULL NO UNI NULL #
1953
fld3 varchar(30) latin1_swedish_ci NO MUL NULL #
1954
fld4 varchar(35) latin1_swedish_ci NO NULL #
1955
fld5 varchar(35) latin1_swedish_ci NO NULL #
1956
fld6 varchar(4) latin1_swedish_ci NO NULL #
1957
1957
show full columns from t2 from test like 's%';
1958
1958
Field Type Collation Null Key Default Extra Privileges Comment
1959
1959
drop table t4, t3, t2, t1;
1960
1960
CREATE TABLE t1 (
1961
id bigint(8) unsigned NOT NULL auto_increment,
1961
id bigint unsigned NOT NULL auto_increment,
1962
1962
pseudo varchar(35) NOT NULL default '',
1963
1963
PRIMARY KEY (id),
1964
1964
UNIQUE KEY pseudo (pseudo)
1968
1968
SELECT 1 as rnd1 from t1 where rand() > 2;
1971
CREATE TABLE t1 (gvid int(10) unsigned default NULL, hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, mmid int(10) unsigned default NULL, hdid int(10) unsigned default NULL, fsid int(10) unsigned default NULL, ctid int(10) unsigned default NULL, dtid int(10) unsigned default NULL, cost int(10) unsigned default NULL, performance int(10) unsigned default NULL, serialnumber bigint(20) unsigned default NULL, monitored tinyint(3) unsigned default '1', removed tinyint(3) unsigned default '0', target tinyint(3) unsigned default '0', dt_modified timestamp NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
1971
CREATE TABLE t1 (gvid int unsigned default NULL, hmid int unsigned default NULL, volid int unsigned default NULL, mmid int unsigned default NULL, hdid int unsigned default NULL, fsid int unsigned default NULL, ctid int unsigned default NULL, dtid int unsigned default NULL, cost int unsigned default NULL, performance int unsigned default NULL, serialnumber bigint unsigned default NULL, monitored tinyint unsigned default '1', removed tinyint unsigned default '0', target tinyint unsigned default '0', dt_modified timestamp NOT NULL, name varchar(255) binary default NULL, description varchar(255) default NULL, UNIQUE KEY hmid (hmid,volid)) ENGINE=MyISAM;
1972
1972
INSERT INTO t1 VALUES (200001,2,1,1,100,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\E$',''),(200002,2,2,1,101,1,1,1,0,0,0,1,0,1,20020425060057,'\\\\ARKIVIO-TESTPDC\\C$',''),(200003,1,3,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,0,1,20020425060427,'c:',NULL);
1973
CREATE TABLE t2 ( hmid int(10) unsigned default NULL, volid int(10) unsigned default NULL, sampletid smallint(5) unsigned default NULL, sampletime datetime default NULL, samplevalue bigint(20) unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
1973
CREATE TABLE t2 ( hmid int unsigned default NULL, volid int unsigned default NULL, sampletid smallint unsigned default NULL, sampletime datetime default NULL, samplevalue bigint unsigned default NULL, KEY idx1 (hmid,volid,sampletid,sampletime)) ENGINE=MyISAM;
1974
1974
INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12:00:01',35);
1975
1975
SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid;
1976
1976
gvid the_success the_fail the_size the_time
2360
CREATE TABLE t1 (b BIGINT(20) UNSIGNED NOT NULL, PRIMARY KEY (b));
2360
CREATE TABLE t1 (b BIGINT UNSIGNED NOT NULL, PRIMARY KEY (b));
2361
2361
INSERT INTO t1 VALUES (0x8000000000000000);
2362
2362
SELECT b FROM t1 WHERE b=0x8000000000000000;
2364
2364
9223372036854775808
2366
CREATE TABLE `t1` ( `gid` int(11) default NULL, `uid` int(11) default NULL);
2367
CREATE TABLE `t2` ( `ident` int(11) default NULL, `level` char(16) default NULL);
2366
CREATE TABLE `t1` ( `gid` int default NULL, `uid` int default NULL);
2367
CREATE TABLE `t2` ( `ident` int default NULL, `level` char(16) default NULL);
2368
2368
INSERT INTO `t2` VALUES (0,'READ');
2369
CREATE TABLE `t3` ( `id` int(11) default NULL, `name` char(16) default NULL);
2369
CREATE TABLE `t3` ( `id` int default NULL, `name` char(16) default NULL);
2370
2370
INSERT INTO `t3` VALUES (1,'fs');
2371
2371
select * from t3 left join t1 on t3.id = t1.uid, t2 where t2.ident in (0, t1.gid, t3.id, 0);
2372
2372
id name gid uid ident level
2373
2373
1 fs NULL NULL 0 READ
2374
2374
drop table t1,t2,t3;
2375
2375
CREATE TABLE t1 (
2376
acct_id int(11) NOT NULL default '0',
2377
profile_id smallint(6) default NULL,
2376
acct_id int NOT NULL default '0',
2377
profile_id smallint default NULL,
2378
2378
UNIQUE KEY t1$acct_id (acct_id),
2379
2379
KEY t1$profile_id (profile_id)
2381
2381
INSERT INTO t1 VALUES (132,17),(133,18);
2382
2382
CREATE TABLE t2 (
2383
profile_id smallint(6) default NULL,
2384
queue_id int(11) default NULL,
2385
seq int(11) default NULL,
2383
profile_id smallint default NULL,
2384
queue_id int default NULL,
2385
seq int default NULL,
2386
2386
KEY t2$queue_id (queue_id)
2388
2388
INSERT INTO t2 VALUES (17,31,4),(17,30,3),(17,36,2),(17,37,1);
2389
2389
CREATE TABLE t3 (
2390
id int(11) NOT NULL default '0',
2391
qtype int(11) default NULL,
2392
seq int(11) default NULL,
2393
warn_lvl int(11) default NULL,
2394
crit_lvl int(11) default NULL,
2395
rr1 tinyint(4) NOT NULL default '0',
2396
rr2 int(11) default NULL,
2397
default_queue tinyint(4) NOT NULL default '0',
2390
id int NOT NULL default '0',
2391
qtype int default NULL,
2392
seq int default NULL,
2393
warn_lvl int default NULL,
2394
crit_lvl int default NULL,
2395
rr1 tinyint NOT NULL default '0',
2396
rr2 int default NULL,
2397
default_queue tinyint NOT NULL default '0',
2398
2398
KEY t3$qtype (qtype),