3 里程碑
一个流程有三个步骤 现在需要把各个步骤的时间填到报表之中。
SERVICESSCHEDULE
SHOP_ID CHAR(3) 商铺号
ORDER_NBR CHAR(10) 订单号
SCH_SEQ INTEGER 步骤
SERVICE_TYPE CHAR(2) 服务类型
SCH_DATE DATE 实施时间
(1 = 'processed')
(2 = 'completed')
(3 = 'confirmed')
CASE子句的使用
SERVICESSCHEDULE
SHOP_ID ORDER_NBR SCH_SEQ SERVICE_TYPE SCH_DATE
2 4155526710 1 1 1994-7-16
2 4155526710 2 1 1994-7-30
2 4155526710 3 1 1994-10-1
2 4155526711 1 1 1994-7-16
2 4155526711 2 1 1994-7-30
2 4155526711 3 1
使用单条语句完成上述功能
数据如下
create table PRINTERCONTROL
(
USER_ID CHAR(10),
PRINTER_NAME CHAR(4) not null,
PRINTER_DESCRIPTION CHAR(40) not null
)
;
alter table PRINTERCONTROL
add primary key (PRINTER_NAME);
insert into PRINTERCONTROL (USER_ID, PRINTER_NAME, PRINTER_DESCRIPTION)
values ('chacha ', 'LPT1', 'First floor_printer ');
insert into PRINTERCONTROL (USER_ID, PRINTER_NAME, PRINTER_DESCRIPTION)
values ('lee ', 'LPT2', 'Second floor_printer ');
insert into PRINTERCONTROL (USER_ID, PRINTER_NAME, PRINTER_DESCRIPTION)
values ('thomas ', 'LPT3', 'Third floor_printer ');
insert into PRINTERCONTROL (USER_ID, PRINTER_NAME, PRINTER_DESCRIPTION)
values (null, 'LPT4', 'Common printer for new user ');
insert into PRINTERCONTROL (USER_ID, PRINTER_NAME, PRINTER_DESCRIPTION)
values (null, 'LPT5', 'Common printer for new user ');
commit;
一个流程有三个步骤 现在需要把各个步骤的时间填到报表之中。
SERVICESSCHEDULE
SHOP_ID CHAR(3) 商铺号
ORDER_NBR CHAR(10) 订单号
SCH_SEQ INTEGER 步骤
SERVICE_TYPE CHAR(2) 服务类型
SCH_DATE DATE 实施时间
(1 = 'processed')
(2 = 'completed')
(3 = 'confirmed')
CASE子句的使用
SERVICESSCHEDULE
SHOP_ID ORDER_NBR SCH_SEQ SERVICE_TYPE SCH_DATE
2 4155526710 1 1 1994-7-16
2 4155526710 2 1 1994-7-30
2 4155526710 3 1 1994-10-1
2 4155526711 1 1 1994-7-16
2 4155526711 2 1 1994-7-30
2 4155526711 3 1
使用单条语句完成上述功能
数据如下
create table PRINTERCONTROL
(
USER_ID CHAR(10),
PRINTER_NAME CHAR(4) not null,
PRINTER_DESCRIPTION CHAR(40) not null
)
;
alter table PRINTERCONTROL
add primary key (PRINTER_NAME);
insert into PRINTERCONTROL (USER_ID, PRINTER_NAME, PRINTER_DESCRIPTION)
values ('chacha ', 'LPT1', 'First floor_printer ');
insert into PRINTERCONTROL (USER_ID, PRINTER_NAME, PRINTER_DESCRIPTION)
values ('lee ', 'LPT2', 'Second floor_printer ');
insert into PRINTERCONTROL (USER_ID, PRINTER_NAME, PRINTER_DESCRIPTION)
values ('thomas ', 'LPT3', 'Third floor_printer ');
insert into PRINTERCONTROL (USER_ID, PRINTER_NAME, PRINTER_DESCRIPTION)
values (null, 'LPT4', 'Common printer for new user ');
insert into PRINTERCONTROL (USER_ID, PRINTER_NAME, PRINTER_DESCRIPTION)
values (null, 'LPT5', 'Common printer for new user ');
commit;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24558043/viewspace-675641/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24558043/viewspace-675641/