1
by brian
clean slate |
1 |
DROP TABLE IF EXISTS t1; |
1063.9.3
by Brian Aker
Partial fix for tests for tmp |
2 |
CREATE TEMPORARY TABLE t1 ( |
642.1.67
by Lee
enable alias and analyze tests |
3 |
cont_nr int NOT NULL auto_increment, |
4 |
ver_nr int NOT NULL default '0', |
|
5 |
aufnr int NOT NULL default '0', |
|
1
by brian
clean slate |
6 |
username varchar(50) NOT NULL default '', |
642.1.67
by Lee
enable alias and analyze tests |
7 |
hdl_nr int NOT NULL default '0', |
873.1.1
by Jay Pipes
Fixes the Field_date class to not allow any invalid input at |
8 |
eintrag date NOT NULL, |
1
by brian
clean slate |
9 |
st_klasse varchar(40) NOT NULL default '', |
10 |
st_wert varchar(40) NOT NULL default '', |
|
11 |
st_zusatz varchar(40) NOT NULL default '', |
|
12 |
st_bemerkung varchar(255) NOT NULL default '', |
|
13 |
kunden_art varchar(40) NOT NULL default '', |
|
642.1.67
by Lee
enable alias and analyze tests |
14 |
mcbs_knr int default NULL, |
15 |
mcbs_aufnr int NOT NULL default '0', |
|
1
by brian
clean slate |
16 |
schufa_status char(1) default '?', |
17 |
bemerkung text, |
|
18 |
wirknetz text, |
|
642.1.67
by Lee
enable alias and analyze tests |
19 |
wf_igz int NOT NULL default '0', |
1
by brian
clean slate |
20 |
tarifcode varchar(80) default NULL, |
21 |
recycle char(1) default NULL, |
|
22 |
sim varchar(30) default NULL, |
|
23 |
mcbs_tpl varchar(30) default NULL, |
|
642.1.67
by Lee
enable alias and analyze tests |
24 |
emp_nr int NOT NULL default '0', |
25 |
laufzeit int default NULL, |
|
1
by brian
clean slate |
26 |
hdl_name varchar(30) default NULL, |
642.1.67
by Lee
enable alias and analyze tests |
27 |
prov_hdl_nr int NOT NULL default '0', |
1
by brian
clean slate |
28 |
auto_wirknetz varchar(50) default NULL, |
29 |
auto_billing varchar(50) default NULL, |
|
30 |
touch timestamp NOT NULL, |
|
31 |
kategorie varchar(50) default NULL, |
|
32 |
kundentyp varchar(20) NOT NULL default '', |
|
33 |
sammel_rech_msisdn varchar(30) NOT NULL default '', |
|
34 |
p_nr varchar(9) NOT NULL default '', |
|
35 |
suffix char(3) NOT NULL default '', |
|
36 |
PRIMARY KEY (cont_nr), |
|
37 |
KEY idx_aufnr(aufnr), |
|
38 |
KEY idx_hdl_nr(hdl_nr), |
|
39 |
KEY idx_st_klasse(st_klasse), |
|
40 |
KEY ver_nr(ver_nr), |
|
41 |
KEY eintrag_idx(eintrag), |
|
42 |
KEY emp_nr_idx(emp_nr), |
|
43 |
KEY wf_igz(wf_igz), |
|
44 |
KEY touch(touch), |
|
45 |
KEY hdl_tag(eintrag,hdl_nr), |
|
46 |
KEY prov_hdl_nr(prov_hdl_nr), |
|
47 |
KEY mcbs_aufnr(mcbs_aufnr), |
|
48 |
KEY kundentyp(kundentyp), |
|
49 |
KEY p_nr(p_nr,suffix) |
|
50 |
) ENGINE=MyISAM; |
|
642.1.67
by Lee
enable alias and analyze tests |
51 |
INSERT INTO t1 VALUES (3359356,405,3359356,'Mustermann Musterfrau',52500,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1485525,2122316,'+','','N',1909160,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',3,24,'MobilCom Shop Koeln',52500,NULL,'auto','2001-02-02 10:59:16','Mobilfunk','PP','','',''); |
52 |
INSERT INTO t1 VALUES (3359357,468,3359357,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1503580,2139699,'+','','P',1909171,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','',''); |
|
53 |
INSERT INTO t1 VALUES (3359358,407,3359358,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1501358,2137473,'N','','N',1909159,'MobilComSuper92000D2',NULL,NULL,'MS9ND2',325,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','',''); |
|
54 |
INSERT INTO t1 VALUES (3359359,468,3359359,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1507831,2143894,'+','','P',1909162,'MobilComSuper9D1T10SFreisprech(Akquise)',NULL,NULL,'MS9NS1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','',''); |
|
55 |
INSERT INTO t1 VALUES (3359360,0,0,'Mustermann Musterfrau',29674907,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1900169997,2414578,'+',NULL,'N',1909148,'',NULL,NULL,'RV99066_2',20,NULL,'POS',29674907,NULL,NULL,20010202105916,'Mobilfunk','','','97317481','007'); |
|
56 |
INSERT INTO t1 VALUES (3359361,406,3359361,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag storniert','','(7001-84):Storno, Kd. mchte nicht mehr','privat',NULL,0,'+','','P',1909150,'MobilComSuper92000D1(Akquise)',NULL,NULL,'MS9ND1',325,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','',''); |
|
57 |
INSERT INTO t1 VALUES (3359362,406,3359362,'Mustermann Musterfrau',7001,'2000-05-20','workflow','Auftrag erledigt','Originalvertrag eingegangen und geprft','','privat',1509984,2145874,'+','','P',1909154,'MobilComSuper92000D1(Akquise)',NULL,NULL,'MS9ND1',327,24,'MobilCom Intern',7003,NULL,'auto',20010202105916,'Mobilfunk','PP','','',''); |
|
1
by brian
clean slate |
58 |
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; |
59 |
Kundentyp kategorie |
|
60 |
Privat (Private Nutzung) Mobilfunk |
|
61 |
Warnings: |
|
62 |
Warning 1052 Column 'kundentyp' in group statement is ambiguous |
|
63 |
drop table t1; |
|
64 |
CREATE TABLE t1 ( |
|
642.1.67
by Lee
enable alias and analyze tests |
65 |
aufnr varchar(12) NOT NULL default '', |
66 |
plnfl varchar(6) NOT NULL default '', |
|
67 |
vornr varchar(4) NOT NULL default '', |
|
68 |
xstatus_vor int NOT NULL default '0' |
|
1
by brian
clean slate |
69 |
);
|
70 |
INSERT INTO t1 VALUES ('40004712','000001','0010',9); |
|
71 |
INSERT INTO t1 VALUES ('40004712','000001','0020',0); |
|
72 |
UPDATE t1 SET t1.xstatus_vor = Greatest(t1.xstatus_vor,1) WHERE t1.aufnr = |
|
73 |
"40004712" AND t1.plnfl = "000001" AND t1.vornr > "0010" ORDER BY t1.vornr |
|
74 |
ASC LIMIT 1; |
|
75 |
drop table t1; |
|
76 |
drop table if exists t1,t2,t3; |
|
77 |
create table t1 (a int, b int, c int); |
|
78 |
create table t2 (d int); |
|
79 |
create table t3 (a1 int, b1 int, c1 int); |
|
80 |
insert into t1 values(1,2,3); |
|
81 |
insert into t1 values(11,22,33); |
|
82 |
insert into t2 values(99); |
|
83 |
select t1.* as 'with_alias' from t1; |
|
642.1.67
by Lee
enable alias and analyze tests |
84 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias' from t1' at line 1 |
1
by brian
clean slate |
85 |
select t2.* as 'with_alias' from t2; |
642.1.67
by Lee
enable alias and analyze tests |
86 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias' from t2' at line 1 |
1
by brian
clean slate |
87 |
select t1.*, t1.* as 'with_alias' from t1; |
642.1.67
by Lee
enable alias and analyze tests |
88 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias' from t1' at line 1 |
1
by brian
clean slate |
89 |
select t1.* as 'with_alias', t1.* from t1; |
642.1.67
by Lee
enable alias and analyze tests |
90 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', t1.* from t1' at line 1 |
1
by brian
clean slate |
91 |
select t1.* as 'with_alias', t1.* as 'alias2' from t1; |
642.1.67
by Lee
enable alias and analyze tests |
92 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', t1.* as 'alias2' from t1' at line 1 |
1
by brian
clean slate |
93 |
select t1.* as 'with_alias', a, t1.* as 'alias2' from t1; |
642.1.67
by Lee
enable alias and analyze tests |
94 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', a, t1.* as 'alias2' from t1' at line 1 |
1
by brian
clean slate |
95 |
select a, t1.* as 'with_alias' from t1; |
642.1.67
by Lee
enable alias and analyze tests |
96 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias' from t1' at line 1 |
1
by brian
clean slate |
97 |
select t1.* as 'with_alias', a from t1; |
642.1.67
by Lee
enable alias and analyze tests |
98 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', a from t1' at line 1 |
1
by brian
clean slate |
99 |
select a, t1.* as 'with_alias', b from t1; |
642.1.67
by Lee
enable alias and analyze tests |
100 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', b from t1' at line 1 |
1
by brian
clean slate |
101 |
select (select d from t2 where d > a), t1.* as 'with_alias' from t1; |
642.1.67
by Lee
enable alias and analyze tests |
102 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias' from t1' at line 1 |
1
by brian
clean slate |
103 |
select t1.* as 'with_alias', (select a from t2 where d > a) from t1; |
642.1.67
by Lee
enable alias and analyze tests |
104 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', (select a from t2 where d > a) from t1' at line 1 |
1
by brian
clean slate |
105 |
select a as 'x', t1.* as 'with_alias' from t1; |
642.1.67
by Lee
enable alias and analyze tests |
106 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias' from t1' at line 1 |
1
by brian
clean slate |
107 |
select t1.* as 'with_alias', a as 'x' from t1; |
642.1.67
by Lee
enable alias and analyze tests |
108 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', a as 'x' from t1' at line 1 |
1
by brian
clean slate |
109 |
select a as 'x', t1.* as 'with_alias', b as 'x' from t1; |
642.1.67
by Lee
enable alias and analyze tests |
110 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', b as 'x' from t1' at line 1 |
1
by brian
clean slate |
111 |
select (select d from t2 where d > a) as 'x', t1.* as 'with_alias' from t1; |
642.1.67
by Lee
enable alias and analyze tests |
112 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias' from t1' at line 1 |
1
by brian
clean slate |
113 |
select t1.* as 'with_alias', (select a from t2 where d > a) as 'x' from t1; |
642.1.67
by Lee
enable alias and analyze tests |
114 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', (select a from t2 where d > a) as 'x' from t1' at line 1 |
1
by brian
clean slate |
115 |
select (select t2.* as 'x' from t2) from t1; |
642.1.67
by Lee
enable alias and analyze tests |
116 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'x' from t2) from t1' at line 1 |
1
by brian
clean slate |
117 |
select a, (select t2.* as 'x' from t2) from t1; |
642.1.67
by Lee
enable alias and analyze tests |
118 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'x' from t2) from t1' at line 1 |
1
by brian
clean slate |
119 |
select t1.*, (select t2.* as 'x' from t2) from t1; |
642.1.67
by Lee
enable alias and analyze tests |
120 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'x' from t2) from t1' at line 1 |
1
by brian
clean slate |
121 |
insert into t3 select t1.* as 'with_alias' from t1; |
642.1.67
by Lee
enable alias and analyze tests |
122 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias' from t1' at line 1 |
1
by brian
clean slate |
123 |
insert into t3 select t2.* as 'with_alias', 1, 2 from t2; |
642.1.67
by Lee
enable alias and analyze tests |
124 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', 1, 2 from t2' at line 1 |
1
by brian
clean slate |
125 |
insert into t3 select t2.* as 'with_alias', d as 'x', d as 'z' from t2; |
642.1.67
by Lee
enable alias and analyze tests |
126 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', d as 'x', d as 'z' from t2' at line 1 |
1
by brian
clean slate |
127 |
insert into t3 select t2.*, t2.* as 'with_alias', 3 from t2; |
642.1.67
by Lee
enable alias and analyze tests |
128 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', 3 from t2' at line 1 |
1
by brian
clean slate |
129 |
create table t3 select t1.* as 'with_alias' from t1; |
642.1.67
by Lee
enable alias and analyze tests |
130 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias' from t1' at line 1 |
1
by brian
clean slate |
131 |
create table t3 select t2.* as 'with_alias', 1, 2 from t2; |
642.1.67
by Lee
enable alias and analyze tests |
132 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', 1, 2 from t2' at line 1 |
1
by brian
clean slate |
133 |
create table t3 select t2.* as 'with_alias', d as 'x', d as 'z' from t2; |
642.1.67
by Lee
enable alias and analyze tests |
134 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', d as 'x', d as 'z' from t2' at line 1 |
1
by brian
clean slate |
135 |
create table t3 select t2.*, t2.* as 'with_alias', 3 from t2; |
642.1.67
by Lee
enable alias and analyze tests |
136 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'as 'with_alias', 3 from t2' at line 1 |
1211.2.1
by Stewart Smith
uncomment out part of alias test, related to bug309865. results checked against mysql alias test. |
137 |
select t1.* from t1; |
138 |
a b c |
|
139 |
1 2 3 |
|
140 |
11 22 33 |
|
141 |
select t2.* from t2; |
|
142 |
d
|
|
143 |
99
|
|
144 |
select t1.*, t1.* from t1; |
|
145 |
a b c a b c |
|
146 |
1 2 3 1 2 3 |
|
147 |
11 22 33 11 22 33 |
|
148 |
select t1.*, a, t1.* from t1; |
|
149 |
a b c a a b c |
|
150 |
1 2 3 1 1 2 3 |
|
151 |
11 22 33 11 11 22 33 |
|
152 |
select a, t1.* from t1; |
|
153 |
a a b c |
|
154 |
1 1 2 3 |
|
155 |
11 11 22 33 |
|
156 |
select t1.*, a from t1; |
|
157 |
a b c a |
|
158 |
1 2 3 1 |
|
159 |
11 22 33 11 |
|
160 |
select a, t1.*, b from t1; |
|
161 |
a a b c b |
|
162 |
1 1 2 3 2 |
|
163 |
11 11 22 33 22 |
|
164 |
select (select d from t2 where d > a), t1.* from t1; |
|
165 |
(select d from t2 where d > a) a b c |
|
166 |
99 1 2 3 |
|
167 |
99 11 22 33 |
|
168 |
select t1.*, (select a from t2 where d > a) from t1; |
|
169 |
a b c (select a from t2 where d > a) |
|
170 |
1 2 3 1 |
|
171 |
11 22 33 11 |
|
172 |
select a as 'x', t1.* from t1; |
|
173 |
x a b c |
|
174 |
1 1 2 3 |
|
175 |
11 11 22 33 |
|
176 |
select t1.*, a as 'x' from t1; |
|
177 |
a b c x |
|
178 |
1 2 3 1 |
|
179 |
11 22 33 11 |
|
180 |
select a as 'x', t1.*, b as 'x' from t1; |
|
181 |
x a b c x |
|
182 |
1 1 2 3 2 |
|
183 |
11 11 22 33 22 |
|
184 |
select (select d from t2 where d > a) as 'x', t1.* from t1; |
|
185 |
x a b c |
|
186 |
99 1 2 3 |
|
187 |
99 11 22 33 |
|
188 |
select t1.*, (select a from t2 where d > a) as 'x' from t1; |
|
189 |
a b c x |
|
190 |
1 2 3 1 |
|
191 |
11 22 33 11 |
|
192 |
select (select t2.* from t2) from t1; |
|
193 |
(select t2.* from t2) |
|
194 |
99
|
|
195 |
99
|
|
196 |
select a, (select t2.* from t2) from t1; |
|
197 |
a (select t2.* from t2) |
|
198 |
1 99 |
|
199 |
11 99 |
|
200 |
select t1.*, (select t2.* from t2) from t1; |
|
201 |
a b c (select t2.* from t2) |
|
202 |
1 2 3 99 |
|
203 |
11 22 33 99 |
|
204 |
insert into t3 select t1.* from t1; |
|
205 |
insert into t3 select t2.*, 1, 2 from t2; |
|
206 |
insert into t3 select t2.*, d as 'x', d as 'z' from t2; |
|
207 |
insert into t3 select t2.*, t2.*, 3 from t2; |
|
208 |
create table t4 select t1.* from t1; |
|
209 |
drop table t4; |
|
210 |
create table t4 select t2.*, 1, 2 from t2; |
|
211 |
drop table t4; |
|
212 |
create table t4 select t2.*, d as 'x', d as 'z' from t2; |
|
213 |
drop table t4; |
|
1
by brian
clean slate |
214 |
drop table t1,t2,t3; |