リビジョン 373
| branches/ddl/20171003_SQL.txt | ||
|---|---|---|
| 1 |
-- ?H???????? |
|
| 2 |
DROP TABLE IF EXISTS constructionmaterialinfo_OLD; |
|
| 3 |
CREATE TABLE constructionmaterialinfo_OLD As Select * from constructionmaterialinfo ; |
|
| 4 |
|
|
| 5 |
drop table if exists constructionmaterialinfo cascade; |
|
| 6 |
|
|
| 7 |
create table constructionmaterialinfo ( |
|
| 8 |
CONSTRUCTIONCODE int(10) unsigned default 0 not null comment '?H?????' |
|
| 9 |
, MATERIALITEMCODE smallint(5) unsigned default 0 not null comment '????i??R?[?h' |
|
| 10 |
, PROCESSDATE datetime comment '?????N????' |
|
| 11 |
, RENTCOUNT smallint(5) unsigned comment '??o??' |
|
| 12 |
, REPAYCOUNT smallint(5) unsigned comment '??p??' |
|
| 13 |
, JUNKCOUNT smallint(5) unsigned comment '?j????' |
|
| 14 |
, COMPLETEFLG tinyint(3) unsigned comment '?????t???O' |
|
| 15 |
, ENTRYDATE datetime comment '?o?^???t' |
|
| 16 |
, UPDATEDATE datetime comment '?X?V???t' |
|
| 17 |
, constraint constructionmaterialinfo_PKC primary key (CONSTRUCTIONCODE,MATERIALITEMCODE,PROCESSDATE) |
|
| 18 |
) comment '?H????????' ; |
|
| 19 |
|
|
| 20 |
Insert INTO constructionmaterialinfo |
|
| 21 |
SELECT |
|
| 22 |
CONSTRUCTIONCODE |
|
| 23 |
, MATERIALITEMCODE |
|
| 24 |
, DATE(ENTRYDATE) |
|
| 25 |
, RENTCOUNT |
|
| 26 |
, REPAYCOUNT |
|
| 27 |
, 0 |
|
| 28 |
, COMPLETEFLG |
|
| 29 |
, ENTRYDATE |
|
| 30 |
, UPDATEDATE |
|
| 31 |
FROM constructionmaterialinfo_OLD |
|
| 32 |
; |
|
| 33 |
commit; |
|
| branches/ddl/20171211_SQL.txt | ||
|---|---|---|
| 1 |
-- ?H??????????f?[?^ |
|
| 2 |
DROP TABLE IF EXISTS constructionledgerdetail_OLD; |
|
| 3 |
CREATE TABLE constructionledgerdetail_OLD As Select * from constructionledgerdetail; |
|
| 4 |
|
|
| 5 |
drop table if exists constructionledgerdetail cascade; |
|
| 6 |
|
|
| 7 |
create table constructionledgerdetail ( |
|
| 8 |
ConstructionCode decimal(10,0) unsigned not null comment '?H???R?[?h' |
|
| 9 |
, GroupCount decimal(2,0) unsigned not null comment '?O???[?v???' |
|
| 10 |
, LineCount decimal(4,0) unsigned not null comment '?s???' |
|
| 11 |
, ComponentCode decimal(5,0) unsigned not null comment '?\???L?[' |
|
| 12 |
, ItemCode decimal(5,0) unsigned not null comment '?H??L?[' |
|
| 13 |
, FirstString varchar(120) comment '???????' |
|
| 14 |
, SecondString varchar(120) comment '?H?????e' |
|
| 15 |
, CompanyType decimal(1,0) not null comment '??????R?[?h?^?C?v' |
|
| 16 |
, CompanyCode decimal(8,0) not null comment '??????R?[?h' |
|
| 17 |
, CompanyName varchar(120) comment '?????????' |
|
| 18 |
, EstimatePrice decimal(12,0) not null comment '?\?Z?i????j???z' |
|
| 19 |
, ExecutionAmount decimal(12,0) not null comment '???s???z' |
|
| 20 |
, AmountConfigRate decimal(5,2) not null comment '???z?\????' |
|
| 21 |
, PaymentBurden decimal(12,0) not null comment '?x????U?z' |
|
| 22 |
, FixDataFlg decimal(1,0) not null comment '???f?[?^?t???O' |
|
| 23 |
, IndependentFlg decimal(1,0) not null comment '????f?[?^?t???O' |
|
| 24 |
, FluctuationFlg decimal(1,0) not null comment '?????f?[?^?t???O' |
|
| 25 |
, SalaryFlg decimal(1,0) not null comment '???^?U????' |
|
| 26 |
, SalaryDays decimal(4,0) not null comment '???^?U??????' |
|
| 27 |
, OperatingFlg decimal(1,0) not null comment '?S?????t???O' |
|
| 28 |
, SourceCode decimal(10,0) unsigned not null comment '???H?????' |
|
| 29 |
, JoinTitleFlg decimal(1,0) not null comment '?H??????^?C?g??' |
|
| 30 |
, SalaryOnRegist decimal(12,0) not null comment '?o?^?????z???^' |
|
| 31 |
, PurchaseOrderFlg decimal(2,0) not null comment '?????????s?t???O' |
|
| 32 |
, DetailCount decimal(4,0) unsigned not null comment '??????' |
|
| 33 |
, EntryDate datetime not null comment '?o?^???t' |
|
| 34 |
, UpdateDate datetime not null comment '?X?V???t' |
|
| 35 |
, constraint constructionledgerdetail_PKC primary key (ConstructionCode,GroupCount,LineCount) |
|
| 36 |
) comment '?H??????????f?[?^' ; |
|
| 37 |
|
|
| 38 |
create index LedgerDetail_Index01 |
|
| 39 |
on constructionledgerdetail(ConstructionCode); |
|
| 40 |
|
|
| 41 |
create index LedgerDetail_Index02 |
|
| 42 |
on constructionledgerdetail(GroupCount); |
|
| 43 |
|
|
| 44 |
create index LedgerDetail_Index03 |
|
| 45 |
on constructionledgerdetail(LineCount); |
|
| 46 |
|
|
| 47 |
create index LedgerDetail_Index04 |
|
| 48 |
on constructionledgerdetail(SourceCode); |
|
| 49 |
|
|
| 50 |
create index LedgerDetail_Index05 |
|
| 51 |
on constructionledgerdetail(DetailCount); |
|
| 52 |
|
|
| 53 |
Insert INTO constructionledgerdetail |
|
| 54 |
SELECT |
|
| 55 |
ConstructionCode |
|
| 56 |
, GroupCount |
|
| 57 |
, LineCount |
|
| 58 |
, ComponentCode |
|
| 59 |
, ItemCode |
|
| 60 |
, FirstString |
|
| 61 |
, SecondString |
|
| 62 |
, CompanyType |
|
| 63 |
, CompanyCode |
|
| 64 |
, CompanyName |
|
| 65 |
, EstimatePrice |
|
| 66 |
, ExecutionAmount |
|
| 67 |
, AmountConfigRate |
|
| 68 |
, PaymentBurden |
|
| 69 |
, FixDataFlg |
|
| 70 |
, IndependentFlg |
|
| 71 |
, FluctuationFlg |
|
| 72 |
, SalaryFlg |
|
| 73 |
, SalaryDays |
|
| 74 |
, OperatingFlg |
|
| 75 |
, SourceCode |
|
| 76 |
, JoinTitleFlg |
|
| 77 |
, SalaryOnRegist |
|
| 78 |
, PurchaseOrderFlg |
|
| 79 |
, 0 |
|
| 80 |
, EntryDate |
|
| 81 |
, UpdateDate |
|
| 82 |
FROM constructionledgerdetail_OLD |
|
| 83 |
; |
|
| 84 |
|
|
| 85 |
ALTER TABLE purchaseorderdetail |
|
| 86 |
CHANGE SourceCode SourceCode decimal(10,0) unsigned not null |
|
| 87 |
COMMENT '???H?????'; |
|
| 88 |
ALTER TABLE purchaseorderdetail |
|
| 89 |
CHANGE SourceLineCnt SourceDetailCnt decimal(4,0) unsigned not null |
|
| 90 |
COMMENT '????????'; |
|
| 91 |
|
|
| 92 |
ALTER TABLE constructionledgerexcute |
|
| 93 |
CHANGE LineCount LineCount decimal(4,0) unsigned not null |
|
| 94 |
comment '?s???'; |
|
| 95 |
|
|
| 96 |
Truncate table paymentapprovalinfo; |
|
| 97 |
Truncate table paymentdatadetail; |
|
| 98 |
Truncate table billingdata; |
|
| 99 |
Truncate table billingdatadetail; |
|
| 100 |
Truncate table billingpaymentsummary; |
|
| 101 |
commit; |
|
| 102 |
|
|
| branches/ddl/20171130_SQL.txt | ||
|---|---|---|
| 1 |
-- ?H??????????f?[?^ |
|
| 2 |
drop table if exists PeriodAvoidance cascade; |
|
| 3 |
|
|
| 4 |
create table PeriodAvoidance ( |
|
| 5 |
ConstructionCode decimal(10,0) unsigned not null comment '?H???R?[?h' |
|
| 6 |
, ConstructionStatusFlg decimal(2,0) not null comment '?H?????t???O' |
|
| 7 |
, FieldNo decimal(2,0) not null comment '?`?F?b?N???t?B?[???h???' |
|
| 8 |
, EntryDate datetime not null comment '?o?^???t' |
|
| 9 |
, UpdateDate datetime not null comment '?X?V???t' |
|
| 10 |
, constraint PeriodAvoidance_PKC primary key (ConstructionCode,ConstructionStatusFlg,FieldNo) |
|
| 11 |
) comment '?H??????????f?[?^' ; |
|
| 12 |
|
|
| 13 |
create index PeriodAvoidance_Index1 |
|
| 14 |
on PeriodAvoidance(ConstructionCode); |
|
| 15 |
|
|
| 16 |
create index PeriodAvoidance_Index2 |
|
| 17 |
on PeriodAvoidance(ConstructionStatusFlg); |
|
| 18 |
|
|
| 19 |
create index PeriodAvoidance_Index3 |
|
| 20 |
on PeriodAvoidance(FieldNo); |
|
| 21 |
|
|
| branches/ddl/20180203_SQL.txt | ||
|---|---|---|
| 1 |
-- ?x??????f?[?^ |
|
| 2 |
create index PayDataDetail_Index1 |
|
| 3 |
on paymentdatadetail(TARGETDATE); |
|
| 4 |
create index PayDataDetail_Index2 |
|
| 5 |
on paymentdatadetail(APPROVALPERSONCODE); |
|
| branches/ddl/20171221_SQL.txt | ||
|---|---|---|
| 1 |
-- ?H????{???
|
|
| 2 |
DROP TABLE IF EXISTS constructionbaseinfo_OLD; |
|
| 3 |
CREATE TABLE constructionbaseinfo_OLD As Select * from constructionbaseinfo; |
|
| 4 |
|
|
| 5 |
drop table if exists constructionbaseinfo cascade; |
|
| 6 |
|
|
| 7 |
create table constructionbaseinfo ( |
|
| 8 |
ConstructionCode decimal(10,0) unsigned not null comment '?H???R?[?h' |
|
| 9 |
, TyingFlg decimal(1,0) not null comment '?R?t?f?[?^?t???O' |
|
| 10 |
, JoinFlg decimal(1,0) not null comment '?????_??H???t???O' |
|
| 11 |
, ConstructionYear smallint(5) unsigned not null comment '?H???N?x' |
|
| 12 |
, ConstructionPeriod smallint(5) unsigned not null comment '?H??????' |
|
| 13 |
, RequestedDate date comment '??????' |
|
| 14 |
, EstimatesSubmitDeadline date comment '?????o????' |
|
| 15 |
, EstimatesSubmittedDate date comment '?????o??' |
|
| 16 |
, ProvisionalOrderDate date comment '?????' |
|
| 17 |
, OrderDate date comment '???' |
|
| 18 |
, OrderStartingDate date comment '?J?n?\???' |
|
| 19 |
, OrderCompletionDate date comment '?????\???' |
|
| 20 |
, PreparationStartDate date comment '?{?H?????J?n??'
|
|
| 21 |
, ConstructionStartingDate date comment '?{?H?J?n??'
|
|
| 22 |
, ConstructionCompletionDate date comment '?{?H??????'
|
|
| 23 |
, NonOrderDate date comment '????' |
|
| 24 |
, OrdersDecisionPrice decimal(12,0) not null comment '??????????z' |
|
| 25 |
, OrdersDecisionPriceInTax decimal(12,0) not null comment '??????????z' |
|
| 26 |
, SalesPersonCode decimal(8,0) comment '?c??S?????' |
|
| 27 |
, ConstructionPersonCode decimal(8,0) not null comment '?H???S????' |
|
| 28 |
, ConstrSubPersonCode decimal(8,0) not null comment '?H?????S????' |
|
| 29 |
, ConstructionInstructor decimal(8,0) not null comment '?H???w????' |
|
| 30 |
, TransferConstruction decimal(8,0) not null comment '?H??????R?[?h' |
|
| 31 |
, TransferConstructionDate date comment '?H??????' |
|
| 32 |
, OrderersDivision decimal(5,0) not null comment '???????' |
|
| 33 |
, OrderersCode decimal(5,0) unsigned not null comment '??????R?[?h' |
|
| 34 |
, EstimatesExpirationDate date comment '????L??????' |
|
| 35 |
, ConstructionPeriodStart date comment '?_??H???J?n??' |
|
| 36 |
, ConstructionPeriodEnd date comment '?_??H??????' |
|
| 37 |
, ConstructionPeriodStart2 date comment '?_??H???J?n?i???????j' |
|
| 38 |
, ConstructionPeriodEnd2 date comment '?_??H???????i???????j' |
|
| 39 |
, StartDate date comment '?H???J?n??' |
|
| 40 |
, EndDate date comment '?H???I????' |
|
| 41 |
, PurchaseOrderMailingDate date comment '???????X????' |
|
| 42 |
, PurchaseOrderReturnDate date comment '???????????' |
|
| 43 |
, PurchaseOrderReturnCheckDate date comment '??????????m?F??' |
|
| 44 |
, ConsumptionTaxFlg decimal(1,0) not null comment '?????t???O' |
|
| 45 |
, PrimeContractorFlg decimal(1,0) not null comment '?????t???O' |
|
| 46 |
, SalesCostFlg decimal(1,0) not null comment '?c??o?????t???O' |
|
| 47 |
, ConstructionStatusFlg decimal(2,0) not null comment '?H?????t???O' |
|
| 48 |
, ConstructionType decimal(5,0) not null comment '?H?????R?[?h' |
|
| 49 |
, EstimateType decimal(1,0) not null comment '??????' |
|
| 50 |
, BillingStartDate date not null comment '?????????J?n??' |
|
| 51 |
, BillingDate date not null comment '??????' |
|
| 52 |
, BillingSplitFlg decimal(1,0) not null comment '??????t???O' |
|
| 53 |
, BillingSendDate date comment '???????X??/??n????' |
|
| 54 |
, LedgerComplateDate date not null comment '?H????????????????t' |
|
| 55 |
, InspectPlanningDate date not null comment '?????\???' |
|
| 56 |
, InspectExecuteDate date not null comment '???????s??' |
|
| 57 |
, RevCompleteDate date not null comment '??????????????' |
|
| 58 |
, EntryDate datetime not null comment '?o?^???t' |
|
| 59 |
, UpdateDate datetime not null comment '?X?V???t' |
|
| 60 |
, constraint constructionbaseinfo_PKC primary key (ConstructionCode) |
|
| 61 |
) comment '?H????{???' ;
|
|
| 62 |
|
|
| 63 |
create index BaseInfo_Index1 |
|
| 64 |
on constructionbaseinfo(ConstructionStatusFlg); |
|
| 65 |
|
|
| 66 |
create index BaseInfo_Index2 |
|
| 67 |
on constructionbaseinfo(EstimateType); |
|
| 68 |
|
|
| 69 |
create index BaseInfo_Index3 |
|
| 70 |
on constructionbaseinfo(SalesPersonCode); |
|
| 71 |
|
|
| 72 |
create index BaseInfo_Index4 |
|
| 73 |
on constructionbaseinfo(ConstructionPersonCode); |
|
| 74 |
|
|
| 75 |
create index BaseInfo_Index5 |
|
| 76 |
on constructionbaseinfo(ConstructionInstructor); |
|
| 77 |
|
|
| 78 |
create index BaseInfo_Index6 |
|
| 79 |
on constructionbaseinfo(ConstructionPeriod); |
|
| 80 |
|
|
| 81 |
Insert INTO constructionbaseinfo |
|
| 82 |
SELECT |
|
| 83 |
ConstructionCode |
|
| 84 |
, TyingFlg |
|
| 85 |
, JoinFlg |
|
| 86 |
, ConstructionYear |
|
| 87 |
, ConstructionPeriod |
|
| 88 |
, RequestedDate |
|
| 89 |
, EstimatesSubmitDeadline |
|
| 90 |
, EstimatesSubmittedDate |
|
| 91 |
, ProvisionalOrderDate |
|
| 92 |
, OrderDate |
|
| 93 |
, OrderStartingDate |
|
| 94 |
, OrderCompletionDate |
|
| 95 |
, PreparationStartDate |
|
| 96 |
, ConstructionStartingDate |
|
| 97 |
, ConstructionCompletionDate |
|
| 98 |
, NonOrderDate |
|
| 99 |
, OrdersDecisionPrice |
|
| 100 |
, OrdersDecisionPriceInTax |
|
| 101 |
, SalesPersonCode |
|
| 102 |
, ConstructionPersonCode |
|
| 103 |
, ConstrSubPersonCode |
|
| 104 |
, ConstructionInstructor |
|
| 105 |
, TransferConstruction |
|
| 106 |
, TransferConstructionDate |
|
| 107 |
, OrderersDivision |
|
| 108 |
, OrderersCode |
|
| 109 |
, EstimatesExpirationDate |
|
| 110 |
, ConstructionPeriodStart |
|
| 111 |
, ConstructionPeriodEnd |
|
| 112 |
, ConstructionPeriodStart2 |
|
| 113 |
, ConstructionPeriodEnd2 |
|
| 114 |
, StartDate |
|
| 115 |
, EndDate |
|
| 116 |
, PurchaseOrderMailingDate |
|
| 117 |
, PurchaseOrderReturnDate |
|
| 118 |
, PurchaseOrderReturnCheckDate |
|
| 119 |
, ConsumptionTaxFlg |
|
| 120 |
, PrimeContractorFlg |
|
| 121 |
, SalesCostFlg |
|
| 122 |
, ConstructionStatusFlg |
|
| 123 |
, ConstructionType |
|
| 124 |
, EstimateType |
|
| 125 |
, BillingStartDate |
|
| 126 |
, BillingDate |
|
| 127 |
, BillingSplitFlg |
|
| 128 |
, BillingSendDate |
|
| 129 |
, LedgerComplateDate |
|
| 130 |
, STR_TO_DATE('0001/01/01', '%Y/%m/%d')
|
|
| 131 |
, STR_TO_DATE('0001/01/01', '%Y/%m/%d')
|
|
| 132 |
, STR_TO_DATE('0001/01/01', '%Y/%m/%d')
|
|
| 133 |
, EntryDate |
|
| 134 |
, UpdateDate |
|
| 135 |
FROM constructionbaseinfo_OLD |
|
| 136 |
; |
|
| 137 |
|
|
| 138 |
-- ?H????{????
|
|
| 139 |
ALTER TABLE constructionbaseinfodetail |
|
| 140 |
CHANGE DetailString DetailString |
|
| 141 |
varchar(300) |
|
| 142 |
comment '??????e'; |
|
| 143 |
commit; |
|
| branches/ddl/20180411_SQL.txt | ||
|---|---|---|
| 1 |
-- ????i?????t?f?[?^ |
|
| 2 |
DROP TABLE IF EXISTS constructionprogressdate_OLD; |
|
| 3 |
|
|
| 4 |
CREATE TABLE constructionprogressdate_OLD As |
|
| 5 |
Select |
|
| 6 |
* |
|
| 7 |
from |
|
| 8 |
constructionprogressdate; |
|
| 9 |
|
|
| 10 |
drop table if exists constructionprogressdate cascade; |
|
| 11 |
|
|
| 12 |
create table constructionprogressdate( |
|
| 13 |
ConstructionCode decimal (10, 0) not null comment '?H?????' |
|
| 14 |
, ConstructionStatusFlg decimal (2, 0) not null comment '???H?????' |
|
| 15 |
, PreviousStatusFlg decimal (2, 0) comment '??X?O???' |
|
| 16 |
, ChangeDate datetime not null comment '?????t' |
|
| 17 |
, ChangePersonCode decimal (8, 0) not null comment '???S????' |
|
| 18 |
, EntryDate datetime not null comment '?o?^???t' |
|
| 19 |
, UpdateDate datetime not null comment '?X?V???t' |
|
| 20 |
, constraint constructionprogressdate_PKC primary key (ConstructionCode, ChangeDate) |
|
| 21 |
) comment '????i?????t?f?[?^'; |
|
| 22 |
|
|
| 23 |
create index ConstrProg_Index1 |
|
| 24 |
on constructionprogressdate(ConstructionCode); |
|
| 25 |
|
|
| 26 |
create index ConstrProg_Index2 |
|
| 27 |
on constructionprogressdate(ConstructionStatusFlg); |
|
| 28 |
|
|
| 29 |
create index ConstrProg_Index3 |
|
| 30 |
on constructionprogressdate(ChangeDate); |
|
| 31 |
|
|
| 32 |
Insert |
|
| 33 |
INTO constructionprogressdate |
|
| 34 |
Select |
|
| 35 |
* |
|
| 36 |
from |
|
| 37 |
constructionprogressdate_OLD; |
|
| 38 |
|
|
| 39 |
-- ?H???????o??f?[?^ |
|
| 40 |
drop table if exists ConstrLedgerExpenses cascade; |
|
| 41 |
|
|
| 42 |
create table ConstrLedgerExpenses ( |
|
| 43 |
ConstructionCode decimal(10,0) unsigned not null comment '?H???R?[?h' |
|
| 44 |
, SeqNo decimal(5,0) not null comment '?}??' |
|
| 45 |
, NameCode decimal(5,0) unsigned not null comment '?o??R?[?h' |
|
| 46 |
, ExpensesRaito decimal(4,2) not null comment '?o??' |
|
| 47 |
, ExpensesValue decimal(10,0) not null comment '?o????z' |
|
| 48 |
, EntryDate datetime not null comment '?o?^???t' |
|
| 49 |
, UpdateDate datetime not null comment '?X?V???t' |
|
| 50 |
, constraint ConstrLedgerExpenses_PKC primary key (ConstructionCode, SeqNo, NameCode) |
|
| 51 |
) comment '?H???????o??f?[?^' ; |
|
| 52 |
|
|
| 53 |
create index ConstrLedgerExpenses_Index1 |
|
| 54 |
on ConstrLedgerExpenses(ConstructionCode); |
|
| 55 |
|
|
| 56 |
create index ConstrLedgerExpenses_Index2 |
|
| 57 |
on ConstrLedgerExpenses(SeqNo); |
|
| 58 |
|
|
| 59 |
create index ConstrLedgerExpenses_Index3 |
|
| 60 |
on ConstrLedgerExpenses(NameCode); |
|
| 61 |
|
|
| 62 |
Insert |
|
| 63 |
INTO constrledgerexpenses |
|
| 64 |
select |
|
| 65 |
A.ConstructionCode |
|
| 66 |
, 1 |
|
| 67 |
, A.ComponentCode |
|
| 68 |
, A.AmountConfigRate |
|
| 69 |
, A.ExecutionAmount |
|
| 70 |
, A.EntryDate |
|
| 71 |
, A.UpdateDate |
|
| 72 |
from |
|
| 73 |
constructionledgerdetail As A |
|
| 74 |
where |
|
| 75 |
A.GroupCount = 1 |
|
| 76 |
And A.ComponentCode = 3; |
|
| 77 |
|
|
| 78 |
Insert |
|
| 79 |
INTO constrledgerexpenses |
|
| 80 |
select |
|
| 81 |
A.ConstructionCode |
|
| 82 |
, 2 |
|
| 83 |
, A.ComponentCode |
|
| 84 |
, A.AmountConfigRate |
|
| 85 |
, A.ExecutionAmount |
|
| 86 |
, A.EntryDate |
|
| 87 |
, A.UpdateDate |
|
| 88 |
from |
|
| 89 |
constructionledgerdetail As A |
|
| 90 |
where |
|
| 91 |
A.GroupCount = 1 |
|
| 92 |
And A.ComponentCode = 1; |
|
| 93 |
|
|
| 94 |
Insert |
|
| 95 |
INTO constrledgerexpenses |
|
| 96 |
select |
|
| 97 |
A.ConstructionCode |
|
| 98 |
, 3 |
|
| 99 |
, A.ComponentCode |
|
| 100 |
, A.AmountConfigRate |
|
| 101 |
, A.ExecutionAmount |
|
| 102 |
, A.EntryDate |
|
| 103 |
, A.UpdateDate |
|
| 104 |
from |
|
| 105 |
constructionledgerdetail As A |
|
| 106 |
where |
|
| 107 |
A.GroupCount = 1 |
|
| 108 |
And A.ComponentCode = 2; |
|
| 109 |
|
|
| 110 |
|
|
| 111 |
-- ?????o???}?X?^ |
|
| 112 |
DROP TABLE IF EXISTS departmentexpensesmaster_OLD; |
|
| 113 |
|
|
| 114 |
CREATE TABLE departmentexpensesmaster_OLD As |
|
| 115 |
Select |
|
| 116 |
* |
|
| 117 |
from |
|
| 118 |
departmentexpensesmaster; |
|
| 119 |
|
|
| 120 |
drop table if exists departmentexpensesmaster cascade; |
|
| 121 |
|
|
| 122 |
create table departmentexpensesmaster ( |
|
| 123 |
DepartmentCode decimal(5,0) unsigned not null comment '?????R?[?h' |
|
| 124 |
, ExpensesPeriod smallint(6) not null comment '?????' |
|
| 125 |
, NameCode decimal(5,0) unsigned not null comment '?o??R?[?h' |
|
| 126 |
, NameString varchar(100) not null comment '????' |
|
| 127 |
, DisplayOrder decimal(5,0) unsigned not null comment '?\????' |
|
| 128 |
, ExpensesRaito decimal(4,2) not null comment '?o??' |
|
| 129 |
, DeleteFlg decimal(1,0) not null comment '???t???O' |
|
| 130 |
, EntryDate datetime not null comment '?o?^???t' |
|
| 131 |
, UpdateDate datetime not null comment '?X?V???t' |
|
| 132 |
, constraint departmentexpensesmaster_PKC primary key (DepartmentCode,ExpensesPeriod,NameCode) |
|
| 133 |
) comment '?????o???}?X?^' ; |
|
| 134 |
|
|
| 135 |
Insert |
|
| 136 |
INTO departmentexpensesmaster |
|
| 137 |
select |
|
| 138 |
A.DepartmentCode |
|
| 139 |
, A.ExpensesPeriod |
|
| 140 |
, A.NameCode |
|
| 141 |
, B.NameString |
|
| 142 |
, A.DisplayOrder |
|
| 143 |
, A.ExpensesRaito |
|
| 144 |
, A.DeleteFlg |
|
| 145 |
, A.EntryDate |
|
| 146 |
, A.UpdateDate |
|
| 147 |
from |
|
| 148 |
departmentexpensesmaster_OLD As A |
|
| 149 |
LEFT JOIN divisionmaster AS B |
|
| 150 |
ON B.DivisionCode = 3 |
|
| 151 |
And B.NameCode = A.NameCode; |
|
| 152 |
|
|
| 153 |
commit; |
|
| branches/ddl/20180402_SQL.txt | ||
|---|---|---|
| 1 |
create index constructionledger_Index1 |
|
| 2 |
on constructionledger(ConstructionStart); |
|
| 3 |
|
|
| 4 |
create index constructionledger_Index2 |
|
| 5 |
on constructionledger(ConstructionEnd); |
|
| 6 |
|
|
| 7 |
create index LedgerDetail_Index06 |
|
| 8 |
on constructionledgerdetail(SalaryFlg); |
|
| 9 |
|
|
| 10 |
create index LedgerDetail_Index07 |
|
| 11 |
on constructionledgerdetail(CompanyCode); |
|
| branches/ddl/20171024_SQL.txt | ||
|---|---|---|
| 1 |
-- ???????f?[?^ |
|
| 2 |
DROP TABLE IF EXISTS billingdata_OLD; |
|
| 3 |
CREATE TABLE billingdata_OLD As Select * from billingdata; |
|
| 4 |
|
|
| 5 |
drop table if exists billingdata cascade; |
|
| 6 |
|
|
| 7 |
create table billingdata ( |
|
| 8 |
COMPANYCODE decimal(8,0) default '0' not null comment '??????R?[?h' |
|
| 9 |
, TARGETDATE decimal(6,0) default '0' not null comment '???N??' |
|
| 10 |
, PAYMENTKIND decimal(1,0) default '0' not null comment '?x????' |
|
| 11 |
, SEQNO decimal(3,0) default '0' not null comment '?A??' |
|
| 12 |
, BILLPRICE decimal(10,0) comment '???????z' |
|
| 13 |
, ENTRYDATE datetime comment '?o?^?N????' |
|
| 14 |
, UPDATEDATE datetime comment '?X?V?N????' |
|
| 15 |
, constraint billingdata_PKC primary key (COMPANYCODE,TARGETDATE,PAYMENTKIND,SEQNO) |
|
| 16 |
) comment '???????f?[?^' ; |
|
| 17 |
|
|
| 18 |
Insert INTO billingdata |
|
| 19 |
SELECT |
|
| 20 |
COMPANYCODE |
|
| 21 |
, TARGETDATE |
|
| 22 |
, 0 |
|
| 23 |
, SEQNO |
|
| 24 |
, BILLPRICE |
|
| 25 |
, ENTRYDATE |
|
| 26 |
, UPDATEDATE |
|
| 27 |
FROM billingdata_OLD |
|
| 28 |
; |
|
| 29 |
commit; |
|
| 30 |
|
|
| 31 |
|
|
| 32 |
-- ??????????f?[?^ |
|
| 33 |
DROP TABLE IF EXISTS billingdatadetail_OLD; |
|
| 34 |
CREATE TABLE billingdatadetail_OLD As Select * from billingdatadetail; |
|
| 35 |
|
|
| 36 |
drop table if exists billingdatadetail cascade; |
|
| 37 |
|
|
| 38 |
create table billingdatadetail ( |
|
| 39 |
COMPANYCODE decimal(8,0) default '0' not null comment '??????R?[?h' |
|
| 40 |
, TARGETDATE decimal(6,0) default '0' not null comment '???N??' |
|
| 41 |
, PAYMENTKIND decimal(1,0) default '0' not null comment '?x????' |
|
| 42 |
, SEQNO decimal(3,0) default '0' not null comment '?A??' |
|
| 43 |
, LINECOUNT decimal(3,0) default '0' not null comment '?s???' |
|
| 44 |
, CONSTRUCTIONCODE decimal(10,0) comment '?H?????' |
|
| 45 |
, CONSTRUCTIONROWCNT decimal(3,0) default '0' not null comment '?s???' |
|
| 46 |
, CONSTRUCTIONCOLCNT decimal(3,0) default '0' not null comment '????' |
|
| 47 |
, FIELDNAME varchar(120) comment '????' |
|
| 48 |
, BILLPRICE decimal(10,0) comment '???????z' |
|
| 49 |
, HIGHWPRICE decimal(10,0) comment '??????' |
|
| 50 |
, HARDWPRICE decimal(10,0) comment '??????' |
|
| 51 |
, INDSWASTETAX decimal(10,0) comment '?Y?p??' |
|
| 52 |
, NOTE varchar(120) comment '???l' |
|
| 53 |
, ENTRYDATE datetime comment '?o?^?N????' |
|
| 54 |
, UPDATEDATE datetime comment '?X?V?N????' |
|
| 55 |
, constraint billingdatadetail_PKC primary key (COMPANYCODE,TARGETDATE,PAYMENTKIND,SEQNO,LINECOUNT) |
|
| 56 |
) comment '??????????f?[?^' ; |
|
| 57 |
|
|
| 58 |
Insert INTO billingdatadetail |
|
| 59 |
SELECT |
|
| 60 |
COMPANYCODE |
|
| 61 |
, TARGETDATE |
|
| 62 |
, 0 |
|
| 63 |
, SEQNO |
|
| 64 |
, LINECOUNT |
|
| 65 |
, CONSTRUCTIONCODE |
|
| 66 |
, CONSTRUCTIONROWCNT |
|
| 67 |
, CONSTRUCTIONCOLCNT |
|
| 68 |
, FIELDNAME |
|
| 69 |
, BILLPRICE |
|
| 70 |
, HIGHWPRICE |
|
| 71 |
, HARDWPRICE |
|
| 72 |
, INDSWASTETAX |
|
| 73 |
, NOTE |
|
| 74 |
, ENTRYDATE |
|
| 75 |
, UPDATEDATE |
|
| 76 |
FROM billingdatadetail_OLD |
|
| 77 |
; |
|
| 78 |
commit; |
|
| 79 |
|
|
| branches/ddl/20170602_SQL.txt | ||
|---|---|---|
| 1 |
DROP TABLE IF EXISTS PurchaseOrderDate; |
|
| 2 |
-- ?????????t?f?[?^ |
|
| 3 |
CREATE TABLE PurchaseOrderDate |
|
| 4 |
( |
|
| 5 |
ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '?H???R?[?h', |
|
| 6 |
SeqNo decimal(3) unsigned NOT NULL COMMENT '???????}??', |
|
| 7 |
CompanyCode decimal(8,0) NOT NULL COMMENT '??????R?[?h', |
|
| 8 |
SendDate date NOT NULL COMMENT '???????X????', |
|
| 9 |
ReturnDate date NOT NULL COMMENT '???????????', |
|
| 10 |
ReturnCheckDate date NOT NULL COMMENT '??????????m?F??', |
|
| 11 |
EntryDate datetime NOT NULL COMMENT '?o?^???t', |
|
| 12 |
UpdateDate datetime NOT NULL COMMENT '?X?V???t', |
|
| 13 |
PRIMARY KEY (ConstructionCode, SeqNo) |
|
| 14 |
) COMMENT = '?????????t?f?[?^'; |
|
| 15 |
|
|
| 16 |
|
|
| 17 |
DROP TABLE IF EXISTS RequestOrderDate; |
|
| 18 |
-- ?????????t?f?[?^ |
|
| 19 |
CREATE TABLE RequestOrderDate |
|
| 20 |
( |
|
| 21 |
ConstructionCode decimal(10,0) unsigned NOT NULL COMMENT '?H???R?[?h', |
|
| 22 |
InvoiceNo decimal(9,0) NOT NULL COMMENT '??????No', |
|
| 23 |
SendDate date NOT NULL COMMENT '???????????X????', |
|
| 24 |
EntryDate datetime NOT NULL COMMENT '?o?^???t', |
|
| 25 |
UpdateDate datetime NOT NULL COMMENT '?X?V???t' |
|
| 26 |
) COMMENT = '?????????t?f?[?^'; |
|
| 27 |
|
|
| branches/ddl/20180323_SQL.txt | ||
|---|---|---|
| 1 |
-- ?S????????????f?[?^ |
|
| 2 |
drop table if exists ChgChargeDep cascade; |
|
| 3 |
|
|
| 4 |
create table ChgChargeDep ( |
|
| 5 |
PersonCode decimal(8,0) not null comment '?S????R?[?h' |
|
| 6 |
, StartDate date not null comment '?J?n?N????' |
|
| 7 |
, CompDate date not null comment '?I???N????' |
|
| 8 |
, DepartmentCode decimal(5,0) unsigned not null comment '?????R?[?h' |
|
| 9 |
, DepartmentName varchar(60) comment '??????' |
|
| 10 |
, EntryDate datetime not null comment '?o?^???t' |
|
| 11 |
, UpdateDate datetime not null comment '?X?V???t' |
|
| 12 |
, constraint ChgChargeDep_PKC primary key (PersonCode, StartDate) |
|
| 13 |
) comment '?S????????????f?[?^' ; |
|
| 14 |
|
|
| 15 |
Insert INTO ChgChargeDep |
|
| 16 |
select |
|
| 17 |
A.PersonCode |
|
| 18 |
, A.StartDate |
|
| 19 |
, A.EndDate |
|
| 20 |
, A.DepartmentCode |
|
| 21 |
, B.DepartmentString |
|
| 22 |
, Now() |
|
| 23 |
, Now() |
|
| 24 |
From |
|
| 25 |
personinchargemaster As A |
|
| 26 |
Left Join departmentmaster As B |
|
| 27 |
On B.DepartmentCode = A.DepartmentCode |
|
| 28 |
; |
|
| 29 |
|
|
| 30 |
update chgchargedep Set CompDate = DATE('2017/07/31'), DepartmentCode = 2, DepartmentName = '?c?U??' Where PersonCode = 20150701 And DATE(StartDate) = DATE('2015/07/01');
|
|
| 31 |
Insert chgchargedep Value(20150701, DATE('2017/08/01'), DATE('0001/01/01'), 1, '?H????', NOW(), NOW());
|
|
| 32 |
|
|
| 33 |
update chgchargedep Set CompDate = DATE('2017/07/31'), DepartmentCode = 1, DepartmentName = '?H????' Where PersonCode = 20160602 And DATE(StartDate) = DATE('2016/06/20');
|
|
| 34 |
Insert chgchargedep Value(20160602, DATE('2017/08/01'), DATE('0001/01/01'), 3, '?c???', NOW(), NOW());
|
|
| 35 |
|
|
| 36 |
update chgchargedep Set CompDate = DATE('2017/07/31'), DepartmentCode = 1, DepartmentName = '?H????' Where PersonCode = 20160701 And DATE(StartDate) = DATE('2016/07/01');
|
|
| 37 |
Insert chgchargedep Value(20160701, DATE('2017/08/01'), DATE('0001/01/01'), 2, '?c?U??', NOW(), NOW());
|
|
| 38 |
commit; |
|
| branches/ddl/20171207_SQL.txt | ||
|---|---|---|
| 1 |
-- ??????????f?[?^ |
|
| 2 |
DROP TABLE IF EXISTS purchaseorderdetail_OLD; |
|
| 3 |
CREATE TABLE purchaseorderdetail_OLD As Select * from purchaseorderdetail; |
|
| 4 |
|
|
| 5 |
drop table if exists purchaseorderdetail cascade; |
|
| 6 |
|
|
| 7 |
create table purchaseorderdetail ( |
|
| 8 |
ConstructionCode decimal(10,0) unsigned not null comment '?H???R?[?h' |
|
| 9 |
, SeqNo decimal(3,0) unsigned not null comment '???????}??' |
|
| 10 |
, GroupCount decimal(1,0) not null comment '?O???[?v???' |
|
| 11 |
, LineCount decimal(3,0) unsigned not null comment '?s???' |
|
| 12 |
, ComponentCode decimal(5,0) unsigned not null comment '?\???L?[' |
|
| 13 |
, ItemCode decimal(5,0) unsigned not null comment '?H??L?[' |
|
| 14 |
, FirstString varchar(120) comment '?H??E?i??' |
|
| 15 |
, SecondString varchar(120) comment '???e????' |
|
| 16 |
, UnitCount decimal(8,2) not null comment '????' |
|
| 17 |
, UnitName varchar(30) comment '?P??' |
|
| 18 |
, UnitPrice decimal(10,0) not null comment '?P??' |
|
| 19 |
, OrdersLinePrice decimal(12,0) comment '???z' |
|
| 20 |
, SourceCode decimal(10,0) unsigned not null comment '?\?Z?????H?????' |
|
| 21 |
, SourceLineCnt decimal(3,0) unsigned not null comment '?????????????s???' |
|
| 22 |
, DataTypeFlag decimal(1,0) unsigned not null comment '?f?[?^?^?C?v?t???O' |
|
| 23 |
, EntryDate datetime not null comment '?o?^???t' |
|
| 24 |
, UpdateDate datetime not null comment '?X?V???t' |
|
| 25 |
, constraint purchaseorderdetail_PKC primary key (ConstructionCode,SeqNo,GroupCount,LineCount) |
|
| 26 |
) comment '??????????f?[?^' ; |
|
| 27 |
|
|
| 28 |
create index POrderDetail_Index1 |
|
| 29 |
on purchaseorderdetail(SourceCode); |
|
| 30 |
|
|
| 31 |
Insert INTO purchaseorderdetail |
|
| 32 |
SELECT |
|
| 33 |
ConstructionCode |
|
| 34 |
, SeqNo |
|
| 35 |
, GroupCount |
|
| 36 |
, LineCount |
|
| 37 |
, ComponentCode |
|
| 38 |
, ItemCode |
|
| 39 |
, FirstString |
|
| 40 |
, SecondString |
|
| 41 |
, UnitCount |
|
| 42 |
, UnitName |
|
| 43 |
, UnitPrice |
|
| 44 |
, OrdersLinePrice |
|
| 45 |
, SourceCode |
|
| 46 |
, SourceLineCnt |
|
| 47 |
, 0 |
|
| 48 |
, EntryDate |
|
| 49 |
, UpdateDate |
|
| 50 |
FROM purchaseorderdetail_OLD |
|
| 51 |
; |
|
| 52 |
update purchaseorderdetail set DataTypeFlag = 1 where FirstString like '%?@??%'; |
|
| 53 |
|
|
| 54 |
commit; |
|
| branches/ddl/20180405_SQL.txt | ||
|---|---|---|
| 1 |
-- ?H????{???
|
|
| 2 |
DROP TABLE IF EXISTS constructionbaseinfo_OLD; |
|
| 3 |
CREATE TABLE constructionbaseinfo_OLD As Select * from constructionbaseinfo; |
|
| 4 |
|
|
| 5 |
drop table if exists constructionbaseinfo cascade; |
|
| 6 |
|
|
| 7 |
create table constructionbaseinfo ( |
|
| 8 |
ConstructionCode decimal(10,0) unsigned not null comment '?H???R?[?h' |
|
| 9 |
, TyingFlg decimal(1,0) not null comment '?R?t?f?[?^?t???O' |
|
| 10 |
, JoinFlg decimal(1,0) not null comment '?????_??H???t???O' |
|
| 11 |
, ConstructionYear smallint(5) unsigned not null comment '?H???N?x' |
|
| 12 |
, ConstructionPeriod smallint(5) unsigned not null comment '?H??????' |
|
| 13 |
, RequestedDate date comment '??????' |
|
| 14 |
, EstimatesSubmitDeadline date comment '?????o????' |
|
| 15 |
, EstimatesSubmittedDate date comment '?????o??' |
|
| 16 |
, ProvisionalOrderDate date comment '?????' |
|
| 17 |
, OrderDate date comment '???' |
|
| 18 |
, OrderStartingDate date comment '?J?n?\???' |
|
| 19 |
, OrderCompletionDate date comment '?????\???' |
|
| 20 |
, PreparationStartDate date comment '?{?H?????J?n??'
|
|
| 21 |
, ConstructionStartingDate date comment '?{?H?J?n??'
|
|
| 22 |
, ConstructionCompletionDate date comment '?{?H??????'
|
|
| 23 |
, NonOrderDate date comment '????' |
|
| 24 |
, OrdersDecisionPrice decimal(12,0) not null comment '??????????z' |
|
| 25 |
, OrdersDecisionPriceInTax decimal(12,0) not null comment '??????????z' |
|
| 26 |
, SalesDepCode decimal(5,0) unsigned not null comment '?c??S????????R?[?h' |
|
| 27 |
, SalesPersonCode decimal(8,0) unsigned not null comment '?c??S????R?[?h' |
|
| 28 |
, SalesSubDepCode decimal(5,0) unsigned not null comment '?c????S????????R?[?h' |
|
| 29 |
, SalesSubPersonCode decimal(8,0) unsigned not null comment '?c????S????R?[?h' |
|
| 30 |
, ConstrDepCode decimal(5,0) unsigned not null comment '?H???S????????R?[?h' |
|
| 31 |
, ConstructionPersonCode decimal(8,0) not null comment '?H???S????R?[?h' |
|
| 32 |
, ConstrSubDepCode decimal(5,0) unsigned not null comment '?H?????S????????R?[?h' |
|
| 33 |
, ConstrSubPersonCode decimal(8,0) not null comment '?H?????S????R?[?h' |
|
| 34 |
, ConstrInstrDepCode decimal(5,0) unsigned not null comment '?H???w?????????R?[?h' |
|
| 35 |
, ConstructionInstructor decimal(8,0) not null comment '?H???w?????R?[?h' |
|
| 36 |
, TransferConstruction decimal(8,0) not null comment '?H??????R?[?h' |
|
| 37 |
, TransferConstructionDate date comment '?H??????' |
|
| 38 |
, OrderersDivision decimal(5,0) not null comment '????????R?[?h' |
|
| 39 |
, OrderersCode decimal(5,0) unsigned not null comment '??????R?[?h' |
|
| 40 |
, EstimatesExpirationDate date comment '????L??????' |
|
| 41 |
, ConstructionPeriodStart date comment '?_??H???J?n??' |
|
| 42 |
, ConstructionPeriodEnd date comment '?_??H??????' |
|
| 43 |
, ConstructionPeriodStart2 date comment '?_??H???J?n?i???????j' |
|
| 44 |
, ConstructionPeriodEnd2 date comment '?_??H???????i???????j' |
|
| 45 |
, StartDate date comment '?H???J?n??' |
|
| 46 |
, EndDate date comment '?H???I????' |
|
| 47 |
, PurchaseOrderMailingDate date comment '???????X????' |
|
| 48 |
, PurchaseOrderReturnDate date comment '???????????' |
|
| 49 |
, PurchaseOrderReturnCheckDate date comment '??????????m?F??' |
|
| 50 |
, ConsumptionTaxFlg decimal(1,0) not null comment '?????t???O' |
|
| 51 |
, PrimeContractorFlg decimal(1,0) not null comment '?????t???O' |
|
| 52 |
, SalesCostFlg decimal(1,0) not null comment '?c??o?????t???O' |
|
| 53 |
, ConstructionStatusFlg decimal(2,0) not null comment '?H?????t???O' |
|
| 54 |
, ConstructionType decimal(5,0) not null comment '?H?????R?[?h' |
|
| 55 |
, EstimateType decimal(1,0) not null comment '??????' |
|
| 56 |
, BillingStartDate date not null comment '?????????J?n??' |
|
| 57 |
, BillingDate date not null comment '??????' |
|
| 58 |
, BillingSplitFlg decimal(1,0) not null comment '??????t???O' |
|
| 59 |
, BillingSendDate date comment '???????X??/??n????' |
|
| 60 |
, LedgerComplateDate date not null comment '?H????????????????t' |
|
| 61 |
, InspectPlanningDate date not null comment '?????\???' |
|
| 62 |
, InspectExecuteDate date not null comment '???????s??' |
|
| 63 |
, RevCompleteDate date not null comment '??????????????' |
|
| 64 |
, EntryDate datetime not null comment '?o?^???t' |
|
| 65 |
, UpdateDate datetime not null comment '?X?V???t' |
|
| 66 |
, constraint constructionbaseinfo_PKC primary key (ConstructionCode) |
|
| 67 |
) comment '?H????{???' ;
|
|
| 68 |
|
|
| 69 |
create index BaseInfo_Index1 |
|
| 70 |
on constructionbaseinfo(ConstructionStatusFlg); |
|
| 71 |
|
|
| 72 |
create index BaseInfo_Index2 |
|
| 73 |
on constructionbaseinfo(EstimateType); |
|
| 74 |
|
|
| 75 |
create index BaseInfo_Index3 |
|
| 76 |
on constructionbaseinfo(SalesPersonCode); |
|
| 77 |
|
|
| 78 |
create index BaseInfo_Index4 |
|
| 79 |
on constructionbaseinfo(ConstructionPersonCode); |
|
| 80 |
|
|
| 81 |
create index BaseInfo_Index5 |
|
| 82 |
on constructionbaseinfo(ConstructionInstructor); |
|
| 83 |
|
|
| 84 |
create index BaseInfo_Index6 |
|
| 85 |
on constructionbaseinfo(ConstructionPeriod); |
|
| 86 |
|
|
| 87 |
Insert INTO constructionbaseinfo |
|
| 88 |
Select |
|
| 89 |
ConstructionCode |
|
| 90 |
, TyingFlg |
|
| 91 |
, JoinFlg |
|
| 92 |
, ConstructionYear |
|
| 93 |
, ConstructionPeriod |
|
| 94 |
, RequestedDate |
|
| 95 |
, EstimatesSubmitDeadline |
|
| 96 |
, EstimatesSubmittedDate |
|
| 97 |
, ProvisionalOrderDate |
|
| 98 |
, OrderDate |
|
| 99 |
, OrderStartingDate |
|
| 100 |
, OrderCompletionDate |
|
| 101 |
, PreparationStartDate |
|
| 102 |
, ConstructionStartingDate |
|
| 103 |
, ConstructionCompletionDate |
|
| 104 |
, NonOrderDate |
|
| 105 |
, OrdersDecisionPrice |
|
| 106 |
, OrdersDecisionPriceInTax |
|
| 107 |
, SalesDepCode |
|
| 108 |
, SalesPersonCode |
|
| 109 |
, 0 |
|
| 110 |
, 0 |
|
| 111 |
, ConstrDepCode |
|
| 112 |
, ConstructionPersonCode |
|
| 113 |
, ConstrSubDepCode |
|
| 114 |
, ConstrSubPersonCode |
|
| 115 |
, ConstrInstrDepCode |
|
| 116 |
, ConstructionInstructor |
|
| 117 |
, TransferConstruction |
|
| 118 |
, TransferConstructionDate |
|
| 119 |
, OrderersDivision |
|
| 120 |
, OrderersCode |
|
| 121 |
, EstimatesExpirationDate |
|
| 122 |
, ConstructionPeriodStart |
|
| 123 |
, ConstructionPeriodEnd |
|
| 124 |
, ConstructionPeriodStart2 |
|
| 125 |
, ConstructionPeriodEnd2 |
|
| 126 |
, StartDate |
|
| 127 |
, EndDate |
|
| 128 |
, PurchaseOrderMailingDate |
|
| 129 |
, PurchaseOrderReturnDate |
|
| 130 |
, PurchaseOrderReturnCheckDate |
|
| 131 |
, ConsumptionTaxFlg |
|
| 132 |
, PrimeContractorFlg |
|
| 133 |
, SalesCostFlg |
|
| 134 |
, ConstructionStatusFlg |
|
| 135 |
, ConstructionType |
|
| 136 |
, EstimateType |
|
| 137 |
, BillingStartDate |
|
| 138 |
, BillingDate |
|
| 139 |
, BillingSplitFlg |
|
| 140 |
, BillingSendDate |
|
| 141 |
, LedgerComplateDate |
|
| 142 |
, InspectPlanningDate |
|
| 143 |
, InspectExecuteDate |
|
| 144 |
, RevCompleteDate |
|
| 145 |
, EntryDate |
|
| 146 |
, UpdateDate |
|
| 147 |
From constructionbaseinfo_OLD; |
|
| 148 |
|
|
| 149 |
-- ?N?}?X?^ |
|
| 150 |
DROP TABLE IF EXISTS yearmaster_OLD; |
|
| 151 |
CREATE TABLE yearmaster_OLD As Select * from yearmaster; |
|
| 152 |
|
|
| 153 |
drop table if exists yearmaster cascade; |
|
| 154 |
|
|
| 155 |
create table yearmaster ( |
|
| 156 |
years smallint(6) not null comment '?N' |
|
| 157 |
, constraint yearmaster_PKC primary key (years) |
|
| 158 |
) comment '?N?}?X?^' ; |
|
| 159 |
|
|
| 160 |
Insert INTO yearmaster |
|
| 161 |
Select * From yearmaster_OLD; |
|
| 162 |
|
|
| 163 |
|
|
| 164 |
-- ???}?X?^ |
|
| 165 |
DROP TABLE IF EXISTS monthmaster_OLD; |
|
| 166 |
CREATE TABLE monthmaster_OLD As Select * from monthmaster; |
|
| 167 |
|
|
| 168 |
drop table if exists monthmaster cascade; |
|
| 169 |
|
|
| 170 |
create table monthmaster ( |
|
| 171 |
month smallint(6) not null comment '??' |
|
| 172 |
, constraint monthmaster_PKC primary key (month) |
|
| 173 |
) comment '???}?X?^' ; |
|
| 174 |
|
|
| 175 |
Insert INTO monthmaster |
|
| 176 |
Select * From monthmaster_OLD; |
|
| 177 |
|
|
| 178 |
|
|
| 179 |
-- ???}?X?^ |
|
| 180 |
DROP TABLE IF EXISTS daymaster_OLD; |
|
| 181 |
CREATE TABLE daymaster_OLD As Select * from daymaster; |
|
| 182 |
|
|
| 183 |
drop table if exists daymaster cascade; |
|
| 184 |
|
|
| 185 |
create table daymaster ( |
|
| 186 |
days smallint(6) not null comment '??' |
|
| 187 |
, constraint daymaster_PKC primary key (days) |
|
| 188 |
) comment '???}?X?^' ; |
|
| 189 |
|
|
| 190 |
Insert INTO daymaster |
|
| 191 |
Select * From daymaster_OLD; |
|
| 192 |
|
|
| 193 |
commit; |
|
| branches/ddl/20170712_SQL.txt | ||
|---|---|---|
| 1 |
DROP TABLE IF EXISTS personinchargemaster_OLD; |
|
| 2 |
CREATE TABLE personinchargemaster_OLD As Select * from personinchargemaster; |
|
| 3 |
|
|
| 4 |
drop index PersonInChargeMaster_Index1 on personinchargemaster; |
|
| 5 |
drop index PersonInChargeMaster_Index2 on personinchargemaster; |
|
| 6 |
|
|
| 7 |
drop table if exists personinchargemaster cascade; |
|
| 8 |
|
|
| 9 |
create table personinchargemaster ( |
|
| 10 |
PersonCode decimal(8,0) unsigned not null comment '?S????R?[?h' |
|
| 11 |
, DisplayOrder decimal(8,0) unsigned not null comment '?\????' |
|
| 12 |
, PersonName varchar(60) not null comment '?S?????' |
|
| 13 |
, StartDate date not null comment '?g?p?J?n?N????' |
|
| 14 |
, EndDate date comment '?g?p?I???N????' |
|
| 15 |
, PassWord varchar(16) comment '?p?X???[?h' |
|
| 16 |
, SecurityManagement decimal(1,0) not null comment '?@????' |
|
| 17 |
, SecCode decimal(2,0) unsigned not null comment '???????' |
|
| 18 |
, MsgBackColor varchar(8) comment '???b?Z?[?W?w?i?F' |
|
| 19 |
, DisplayString varchar(20) comment '?\???E???????' |
|
| 20 |
, DepartmentCode decimal(5,0) unsigned comment '?????R?[?h' |
|
| 21 |
, MonthlySalary decimal(11,0) not null comment '???????z' |
|
| 22 |
, YearSalary decimal(12,0) not null comment '?N????z' |
|
| 23 |
, Qualification varchar(120) comment '???i?????' |
|
| 24 |
, SealPrintName varchar(5) comment '???\????' |
|
| 25 |
, EmployeeClassFlg decimal(1,0) not null comment '?????' |
|
| 26 |
, LedgerFlg decimal(1,0) not null comment '???v?Z???t???O' |
|
| 27 |
, CommutingDistance decimal(5,2) not null comment '??????' |
|
| 28 |
, CommuteCosts decimal(5,0) not null comment '??????' |
|
| 29 |
, DeleteFlg decimal(1,0) not null comment '???t???O' |
|
| 30 |
, EntryDate datetime not null comment '?o?^???t' |
|
| 31 |
, UpdateDate datetime not null comment '?X?V???t' |
|
| 32 |
, constraint personinchargemaster_PKC primary key (PersonCode) |
|
| 33 |
) comment '?S????}?X?^' ; |
|
| 34 |
|
|
| 35 |
create index PersonInChargeMaster_Index1 |
|
| 36 |
on personinchargemaster(StartDate); |
|
| 37 |
|
|
| 38 |
create index PersonInChargeMaster_Index2 |
|
| 39 |
on personinchargemaster(DepartmentCode); |
|
| 40 |
|
|
| 41 |
Insert INTO personinchargemaster |
|
| 42 |
SELECT |
|
| 43 |
PersonCode |
|
| 44 |
, DisplayOrder |
|
| 45 |
, PersonName |
|
| 46 |
, StartDate |
|
| 47 |
, EndDate |
|
| 48 |
, PassWord |
|
| 49 |
, SecurityManagement |
|
| 50 |
, SecCode |
|
| 51 |
, MsgBackColor |
|
| 52 |
, DisplayString |
|
| 53 |
, DepartmentCode |
|
| 54 |
, MonthlySalary |
|
| 55 |
, YearSalary |
|
| 56 |
, Qualification |
|
| 57 |
, SealPrintName |
|
| 58 |
, EmployeeClassFlg |
|
| 59 |
, LedgerFlg |
|
| 60 |
, 0 |
|
| 61 |
, 0 |
|
| 62 |
, DeleteFlg |
|
| 63 |
, EntryDate |
|
| 64 |
, UpdateDate |
|
| 65 |
FROM personinchargemaster_OLD |
|
| 66 |
; |
|
| 67 |
commit; |
|
| 68 |
|
|
| 69 |
DROP TABLE IF EXISTS SystemMaster_OLD; |
|
| 70 |
CREATE TABLE SystemMaster_OLD As Select * from SystemMaster; |
|
| 71 |
DROP TABLE IF EXISTS SystemMaster; |
|
| 72 |
|
|
| 73 |
-- ????}?X?^ |
|
| 74 |
CREATE TABLE SystemMaster |
|
| 75 |
( |
|
| 76 |
SystemCode decimal(3,0) unsigned not null comment '???R?[?h' |
|
| 77 |
, CompanyName1 varchar(60) not null comment '?????P' |
|
| 78 |
, CompanyName2 varchar(60) comment '?????Q' |
|
| 79 |
, CEOName varchar(60) not null comment '??\?????' |
|
| 80 |
, CEOPositionName varchar(60) comment '??\???E??' |
|
| 81 |
, ZipCode varchar(8) not null comment '?X????' |
|
| 82 |
, Address1 varchar(60) not null comment '?Z???P' |
|
| 83 |
, Address2 varchar(60) comment '?Z??2' |
|
| 84 |
, Address3 varchar(60) comment '?Z??3' |
|
| 85 |
, PhoneNumber varchar(13) not null comment '?d?b???' |
|
| 86 |
, FaxNumber varchar(13) comment 'FAX???' |
|
| 87 |
, HomePageURL varchar(120) comment '?z?[???y?[?WURL' |
|
| 88 |
, ConstructionExpenses decimal(4,2) not null comment '?H?????o??' |
|
| 89 |
, OfficeExpenses decimal(4,2) not null comment '???????o??' |
|
| 90 |
, OperatingExpenses decimal(4,2) not null comment '?c??o??' |
|
| 91 |
, ConsumptionTax decimal(4,2) not null comment '?????' |
|
| 92 |
, CooperationRate decimal(4,2) not null comment '???????' |
|
| 93 |
, StatutoryWelfareRate decimal(4,2) not null comment '?@???????' |
|
| 94 |
, FuelPrice decimal(5,2) NOT NULL COMMENT '?R???L???P??' |
|
| 95 |
, AreaDistance decimal(5,2) NOT NULL COMMENT '????u????????' |
|
| 96 |
, ExcelSavePath varchar(120) comment 'Excel????p?X' |
|
| 97 |
, BusinessPeriod smallint(6) not null comment '????c?????' |
|
| 98 |
, ConstructionYear smallint(6) not null comment '????H???N?x' |
|
| 99 |
, BusinessBeginningDate varchar(5) not null comment '?c????????' |
|
| 100 |
, ConstructionBeginningDate varchar(5) not null comment '?H???N?x?????' |
|
| 101 |
, ConstructionNoBase decimal(1,0) not null comment '?H????????l' |
|
| 102 |
, SloganString1 varchar(100) comment '?W??1' |
|
| 103 |
, SloganString2 varchar(100) comment '?W??2' |
|
| 104 |
, SloganString3 varchar(100) comment '?W??3' |
|
| 105 |
, EntryDate datetime not null comment '?o?^???t' |
|
| 106 |
, UpdateDate datetime not null comment '?X?V???t' |
|
| 107 |
, constraint systemmaster_PKC primary key (SystemCode) |
|
| 108 |
) COMMENT = '????}?X?^'; |
|
| 109 |
|
|
| 110 |
Insert INTO SystemMaster |
|
| 111 |
SELECT |
|
| 112 |
SystemCode |
|
| 113 |
, CompanyName1 |
|
| 114 |
, CompanyName2 |
|
| 115 |
, CEOName |
|
| 116 |
, CEOPositionName |
|
| 117 |
, ZipCode |
|
| 118 |
, Address1 |
|
| 119 |
, Address2 |
|
| 120 |
, Address3 |
|
| 121 |
, PhoneNumber |
|
| 122 |
, FaxNumber |
|
| 123 |
, HomePageURL |
|
| 124 |
, ConstructionExpenses |
|
| 125 |
, OfficeExpenses |
|
| 126 |
, OperatingExpenses |
|
| 127 |
, ConsumptionTax |
|
| 128 |
, CooperationRate |
|
| 129 |
, StatutoryWelfareRate |
|
| 130 |
, 0 |
|
| 131 |
, 0 |
|
| 132 |
, ExcelSavePath |
|
| 133 |
, BusinessPeriod |
|
| 134 |
, ConstructionYear |
|
| 135 |
, BusinessBeginningDate |
|
| 136 |
, ConstructionBeginningDate |
|
| 137 |
, ConstructionNoBase |
|
| 138 |
, SloganString1 |
|
| 139 |
, SloganString2 |
|
| 140 |
, SloganString3 |
|
| 141 |
, EntryDate |
|
| 142 |
, UpdateDate |
|
| 143 |
FROM SystemMaster_OLD |
|
| 144 |
; |
|
| 145 |
commit; |
|
| 146 |
|
|
| 147 |
insert |
|
| 148 |
into approvalmaster( |
|
| 149 |
SELECT |
|
| 150 |
11 |
|
| 151 |
, DepartmentCode |
|
| 152 |
, SeqNo |
|
| 153 |
, DisplayOrder |
|
| 154 |
, ApprovalPerson |
|
| 155 |
, ApprovalAuthority |
|
| 156 |
, EntryDate |
|
| 157 |
, UpdateDate |
|
| 158 |
FROM |
|
| 159 |
approvalmaster |
|
| 160 |
where |
|
| 161 |
ApprovalCode = 99 |
|
| 162 |
); |
|
| 163 |
|
|
| 164 |
insert |
|
| 165 |
into approvalmaster( |
|
| 166 |
SELECT |
|
| 167 |
12 |
|
| 168 |
, DepartmentCode |
|
| 169 |
, SeqNo |
|
| 170 |
, DisplayOrder |
|
| 171 |
, ApprovalPerson |
|
| 172 |
, ApprovalAuthority |
|
| 173 |
, EntryDate |
|
| 174 |
, UpdateDate |
|
| 175 |
FROM |
|
| 176 |
approvalmaster |
|
| 177 |
where |
|
| 178 |
ApprovalCode = 99 |
|
| 179 |
); |
|
| 180 |
|
|
| 181 |
delete |
|
| 182 |
from |
|
| 183 |
approvalmaster |
|
| 184 |
where |
|
| 185 |
ApprovalCode >= 98; |
|
| 186 |
|
|
| 187 |
commit; |
|
| 188 |
|
|
| branches/ddl/20180324_SQL.txt | ||
|---|---|---|
| 1 |
|
|
| 2 |
-- ?H???S???????f?[?^ |
|
| 3 |
drop table if exists ConstrChgCharge cascade; |
|
| 4 |
|
|
| 5 |
create table ConstrChgCharge ( |
|
| 6 |
ConstructionCode decimal(10,0) unsigned not null comment '?H???R?[?h' |
|
| 7 |
, Division decimal(1,0) not null comment '????' |
|
| 8 |
, SeqNo smallint(5) unsigned not null comment '?A??' |
|
| 9 |
, DepartmentCode decimal(5,0) unsigned not null comment '?????R?[?h' |
|
| 10 |
, PersonCode decimal(8,0) not null comment '?S????R?[?h' |
|
| 11 |
, StartDate date comment '?S???J?n?N????' |
|
| 12 |
, CompDate date comment '?S???I???N????' |
|
| 13 |
, EntryDate datetime not null comment '?o?^???t' |
|
| 14 |
, UpdateDate datetime not null comment '?X?V???t' |
|
| 15 |
, constraint ConstrChgCharge_PKC primary key (ConstructionCode, Division, SeqNo) |
|
| 16 |
) comment '?H???S???????f?[?^' ; |
|
| 17 |
|
|
| 18 |
-- ?H????{???
|
|
| 19 |
DROP TABLE IF EXISTS constructionbaseinfo_OLD; |
|
| 20 |
CREATE TABLE constructionbaseinfo_OLD As Select * from constructionbaseinfo; |
|
| 21 |
|
|
| 22 |
drop table if exists constructionbaseinfo cascade; |
|
| 23 |
|
|
| 24 |
create table constructionbaseinfo ( |
|
| 25 |
ConstructionCode decimal(10,0) unsigned not null comment '?H???R?[?h' |
|
| 26 |
, TyingFlg decimal(1,0) not null comment '?R?t?f?[?^?t???O' |
|
| 27 |
, JoinFlg decimal(1,0) not null comment '?????_??H???t???O' |
|
| 28 |
, ConstructionYear smallint(5) unsigned not null comment '?H???N?x' |
|
| 29 |
, ConstructionPeriod smallint(5) unsigned not null comment '?H??????' |
|
| 30 |
, RequestedDate date comment '??????' |
|
| 31 |
, EstimatesSubmitDeadline date comment '?????o????' |
|
| 32 |
, EstimatesSubmittedDate date comment '?????o??' |
|
| 33 |
, ProvisionalOrderDate date comment '?????' |
|
| 34 |
, OrderDate date comment '???' |
|
| 35 |
, OrderStartingDate date comment '?J?n?\???' |
|
| 36 |
, OrderCompletionDate date comment '?????\???' |
|
| 37 |
, PreparationStartDate date comment '?{?H?????J?n??'
|
|
| 38 |
, ConstructionStartingDate date comment '?{?H?J?n??'
|
|
| 39 |
, ConstructionCompletionDate date comment '?{?H??????'
|
|
| 40 |
, NonOrderDate date comment '????' |
|
| 41 |
, OrdersDecisionPrice decimal(12,0) not null comment '??????????z' |
|
| 42 |
, OrdersDecisionPriceInTax decimal(12,0) not null comment '??????????z' |
|
| 43 |
, SalesDepCode decimal(5,0) unsigned not null comment '?c??S????????R?[?h' |
|
| 44 |
, SalesPersonCode decimal(8,0) unsigned not null comment '?c??S????R?[?h' |
|
| 45 |
, ConstrDepCode decimal(5,0) unsigned not null comment '?H???S????????R?[?h' |
|
| 46 |
, ConstructionPersonCode decimal(8,0) not null comment '?H???S????R?[?h' |
|
| 47 |
, ConstrSubDepCode decimal(5,0) unsigned not null comment '?H?????S????????R?[?h' |
|
| 48 |
, ConstrSubPersonCode decimal(8,0) not null comment '?H?????S????R?[?h' |
|
| 49 |
, ConstrInstrDepCode decimal(5,0) unsigned not null comment '?H???w?????????R?[?h' |
|
| 50 |
, ConstructionInstructor decimal(8,0) not null comment '?H???w?????R?[?h' |
|
| 51 |
, TransferConstruction decimal(8,0) not null comment '?H??????R?[?h' |
|
| 52 |
, TransferConstructionDate date comment '?H??????' |
|
| 53 |
, OrderersDivision decimal(5,0) not null comment '????????R?[?h' |
|
| 54 |
, OrderersCode decimal(5,0) unsigned not null comment '??????R?[?h' |
|
| 55 |
, EstimatesExpirationDate date comment '????L??????' |
|
| 56 |
, ConstructionPeriodStart date comment '?_??H???J?n??' |
|
| 57 |
, ConstructionPeriodEnd date comment '?_??H??????' |
|
| 58 |
, ConstructionPeriodStart2 date comment '?_??H???J?n?i???????j' |
|
| 59 |
, ConstructionPeriodEnd2 date comment '?_??H???????i???????j' |
|
| 60 |
, StartDate date comment '?H???J?n??' |
|
| 61 |
, EndDate date comment '?H???I????' |
|
| 62 |
, PurchaseOrderMailingDate date comment '???????X????' |
|
| 63 |
, PurchaseOrderReturnDate date comment '???????????' |
|
| 64 |
, PurchaseOrderReturnCheckDate date comment '??????????m?F??' |
|
| 65 |
, ConsumptionTaxFlg decimal(1,0) not null comment '?????t???O' |
|
| 66 |
, PrimeContractorFlg decimal(1,0) not null comment '?????t???O' |
|
| 67 |
, SalesCostFlg decimal(1,0) not null comment '?c??o?????t???O' |
|
| 68 |
, ConstructionStatusFlg decimal(2,0) not null comment '?H?????t???O' |
|
| 69 |
, ConstructionType decimal(5,0) not null comment '?H?????R?[?h' |
|
| 70 |
, EstimateType decimal(1,0) not null comment '??????' |
|
| 71 |
, BillingStartDate date not null comment '?????????J?n??' |
|
| 72 |
, BillingDate date not null comment '??????' |
|
| 73 |
, BillingSplitFlg decimal(1,0) not null comment '??????t???O' |
|
| 74 |
, BillingSendDate date comment '???????X??/??n????' |
|
| 75 |
, LedgerComplateDate date not null comment '?H????????????????t' |
|
| 76 |
, InspectPlanningDate date not null comment '?????\???' |
|
| 77 |
, InspectExecuteDate date not null comment '???????s??' |
|
| 78 |
, RevCompleteDate date not null comment '??????????????' |
|
| 79 |
, EntryDate datetime not null comment '?o?^???t' |
|
| 80 |
, UpdateDate datetime not null comment '?X?V???t' |
|
| 81 |
, constraint constructionbaseinfo_PKC primary key (ConstructionCode) |
|
| 82 |
) comment '?H????{???' ;
|
|
| 83 |
|
|
| 84 |
create index BaseInfo_Index1 |
|
| 85 |
on constructionbaseinfo(ConstructionStatusFlg); |
|
| 86 |
|
|
| 87 |
create index BaseInfo_Index2 |
|
| 88 |
on constructionbaseinfo(EstimateType); |
|
| 89 |
|
|
| 90 |
create index BaseInfo_Index3 |
|
| 91 |
on constructionbaseinfo(SalesPersonCode); |
|
| 92 |
|
|
| 93 |
create index BaseInfo_Index4 |
|
| 94 |
on constructionbaseinfo(ConstructionPersonCode); |
|
| 95 |
|
|
| 96 |
create index BaseInfo_Index5 |
|
| 97 |
on constructionbaseinfo(ConstructionInstructor); |
|
| 98 |
|
|
| 99 |
create index BaseInfo_Index6 |
|
| 100 |
on constructionbaseinfo(ConstructionPeriod); |
|
| 101 |
|
|
| 102 |
Insert INTO constructionbaseinfo |
|
| 103 |
SELECT |
|
| 104 |
A.ConstructionCode |
|
| 105 |
, A.TyingFlg |
|
| 106 |
, A.JoinFlg |
|
| 107 |
, A.ConstructionYear |
|
| 108 |
, A.ConstructionPeriod |
|
| 109 |
, A.RequestedDate |
|
| 110 |
, A.EstimatesSubmitDeadline |
|
| 111 |
, A.EstimatesSubmittedDate |
|
| 112 |
, A.ProvisionalOrderDate |
|
| 113 |
, A.OrderDate |
|
| 114 |
, A.OrderStartingDate |
|
| 115 |
, A.OrderCompletionDate |
|
| 116 |
, A.PreparationStartDate |
|
| 117 |
, A.ConstructionStartingDate |
|
| 118 |
, A.ConstructionCompletionDate |
|
| 119 |
, A.NonOrderDate |
|
| 120 |
, A.OrdersDecisionPrice |
|
| 121 |
, A.OrdersDecisionPriceInTax |
|
| 122 |
, B.DepartmentCode |
|
| 123 |
, A.SalesPersonCode |
|
| 124 |
, ifnull(C.DepartmentCode, 0) |
|
| 125 |
, A.ConstructionPersonCode |
|
| 126 |
, ifnull(D.DepartmentCode, 0) |
|
| 127 |
, A.ConstrSubPersonCode |
|
| 128 |
, ifnull(E.DepartmentCode, 0) |
|
| 129 |
, A.ConstructionInstructor |
|
| 130 |
, A.TransferConstruction |
|
| 131 |
, A.TransferConstructionDate |
|
| 132 |
, A.OrderersDivision |
|
| 133 |
, A.OrderersCode |
|
| 134 |
, A.EstimatesExpirationDate |
|
| 135 |
, A.ConstructionPeriodStart |
|
| 136 |
, A.ConstructionPeriodEnd |
|
| 137 |
, A.ConstructionPeriodStart2 |
|
| 138 |
, A.ConstructionPeriodEnd2 |
|
| 139 |
, A.StartDate |
|
| 140 |
, A.EndDate |
|
| 141 |
, A.PurchaseOrderMailingDate |
|
| 142 |
, A.PurchaseOrderReturnDate |
|
| 143 |
, A.PurchaseOrderReturnCheckDate |
|
| 144 |
, A.ConsumptionTaxFlg |
|
| 145 |
, A.PrimeContractorFlg |
|
| 146 |
, A.SalesCostFlg |
|
| 147 |
, A.ConstructionStatusFlg |
|
| 148 |
, A.ConstructionType |
|
| 149 |
, A.EstimateType |
|
| 150 |
, A.BillingStartDate |
|
| 151 |
, A.BillingDate |
|
| 152 |
, A.BillingSplitFlg |
|
| 153 |
, A.BillingSendDate |
|
| 154 |
, A.LedgerComplateDate |
|
| 155 |
, InspectPlanningDate |
|
| 156 |
, InspectExecuteDate |
|
| 157 |
, RevCompleteDate |
|
| 158 |
, A.EntryDate |
|
| 159 |
, A.UpdateDate |
|
| 160 |
FROM |
|
| 161 |
constructionbaseinfo_OLD As A |
|
| 162 |
Left Join chgchargedep As B |
|
| 163 |
On B.PersonCode = A.SalesPersonCode |
|
| 164 |
AND ( |
|
| 165 |
DATE (B.StartDate) <= DATE ('2016/07/31')
|
|
| 166 |
AND ( |
|
| 167 |
DATE ('2015/08/01') <= DATE (B.CompDate)
|
|
| 168 |
OR DATE ('0001/01/01') = DATE (B.CompDate)
|
|
| 169 |
) |
|
| 170 |
) |
|
| 171 |
Left Join chgchargedep As C |
|
| 172 |
On C.PersonCode = A.ConstructionPersonCode |
|
| 173 |
AND ( |
|
| 174 |
DATE (C.StartDate) <= DATE ('2016/07/31')
|
|
| 175 |
AND ( |
|
| 176 |
DATE ('2015/08/01') <= DATE (C.CompDate)
|
|
| 177 |
OR DATE ('0001/01/01') = DATE (C.CompDate)
|
|
| 178 |
) |
|
| 179 |
) |
|
| 180 |
Left Join chgchargedep As D |
|
| 181 |
On D.PersonCode = A.ConstrSubPersonCode |
|
| 182 |
AND ( |
|
| 183 |
DATE (D.StartDate) <= DATE ('2016/07/31')
|
|
| 184 |
AND ( |
|
| 185 |
DATE ('2015/08/01') <= DATE (D.CompDate)
|
|
| 186 |
OR DATE ('0001/01/01') = DATE (D.CompDate)
|
|
| 187 |
) |
|
| 188 |
) |
|
| 189 |
Left Join chgchargedep As E |
|
| 190 |
On E.PersonCode = A.ConstructionInstructor |
|
| 191 |
AND ( |
|
| 192 |
DATE (D.StartDate) <= DATE ('2016/07/31')
|
|
| 193 |
AND ( |
|
| 194 |
DATE ('2015/08/01') <= DATE (D.CompDate)
|
|
| 195 |
OR DATE ('0001/01/01') = DATE (D.CompDate)
|
|
| 196 |
) |
|
| 197 |
) |
|
| 198 |
Where A.ConstructionPeriod = 15 |
|
| 199 |
; |
|
| 200 |
|
|
| 201 |
Insert INTO constructionbaseinfo |
|
| 202 |
SELECT |
|
| 203 |
A.ConstructionCode |
|
| 204 |
, A.TyingFlg |
|
| 205 |
, A.JoinFlg |
|
| 206 |
, A.ConstructionYear |
|
| 207 |
, A.ConstructionPeriod |
|
| 208 |
, A.RequestedDate |
|
| 209 |
, A.EstimatesSubmitDeadline |
|
| 210 |
, A.EstimatesSubmittedDate |
|
| 211 |
, A.ProvisionalOrderDate |
|
| 212 |
, A.OrderDate |
|
| 213 |
, A.OrderStartingDate |
|
| 214 |
, A.OrderCompletionDate |
|
| 215 |
, A.PreparationStartDate |
|
| 216 |
, A.ConstructionStartingDate |
|
| 217 |
, A.ConstructionCompletionDate |
|
| 218 |
, A.NonOrderDate |
|
| 219 |
, A.OrdersDecisionPrice |
|
| 220 |
, A.OrdersDecisionPriceInTax |
|
| 221 |
, B.DepartmentCode |
|
| 222 |
, A.SalesPersonCode |
|
| 223 |
, ifnull(C.DepartmentCode, 0) |
|
| 224 |
, A.ConstructionPersonCode |
|
| 225 |
, ifnull(D.DepartmentCode, 0) |
|
| 226 |
, A.ConstrSubPersonCode |
|
| 227 |
, ifnull(E.DepartmentCode, 0) |
|
| 228 |
, A.ConstructionInstructor |
|
| 229 |
, A.TransferConstruction |
|
| 230 |
, A.TransferConstructionDate |
|
| 231 |
, A.OrderersDivision |
|
| 232 |
, A.OrderersCode |
|
| 233 |
, A.EstimatesExpirationDate |
|
| 234 |
, A.ConstructionPeriodStart |
|
| 235 |
, A.ConstructionPeriodEnd |
|
| 236 |
, A.ConstructionPeriodStart2 |
|
| 237 |
, A.ConstructionPeriodEnd2 |
|
| 238 |
, A.StartDate |
|
| 239 |
, A.EndDate |
|
| 240 |
, A.PurchaseOrderMailingDate |
|
| 241 |
, A.PurchaseOrderReturnDate |
|
| 242 |
, A.PurchaseOrderReturnCheckDate |
|
| 243 |
, A.ConsumptionTaxFlg |
|
| 244 |
, A.PrimeContractorFlg |
|
| 245 |
, A.SalesCostFlg |
|
| 246 |
, A.ConstructionStatusFlg |
|
| 247 |
, A.ConstructionType |
|
| 248 |
, A.EstimateType |
|
| 249 |
, A.BillingStartDate |
|
| 250 |
, A.BillingDate |
|
| 251 |
, A.BillingSplitFlg |
|
| 252 |
, A.BillingSendDate |
|
| 253 |
, A.LedgerComplateDate |
|
| 254 |
, InspectPlanningDate |
|
| 255 |
, InspectExecuteDate |
|
| 256 |
, RevCompleteDate |
|
| 257 |
, A.EntryDate |
|
| 258 |
, A.UpdateDate |
|
| 259 |
FROM |
|
| 260 |
constructionbaseinfo_OLD As A |
|
| 261 |
Left Join chgchargedep As B |
|
| 262 |
On B.PersonCode = A.SalesPersonCode |
|
| 263 |
AND ( |
|
| 264 |
DATE (B.StartDate) <= DATE ('2017/07/31')
|
|
| 265 |
AND ( |
|
| 266 |
DATE ('2016/08/01') <= DATE (B.CompDate)
|
|
| 267 |
OR DATE ('0001/01/01') = DATE (B.CompDate)
|
|
| 268 |
) |
|
| 269 |
) |
|
| 270 |
Left Join chgchargedep As C |
|
| 271 |
On C.PersonCode = A.ConstructionPersonCode |
|
| 272 |
AND ( |
|
| 273 |
DATE (C.StartDate) <= DATE ('2017/07/31')
|
|
| 274 |
AND ( |
|
| 275 |
DATE ('2016/08/01') <= DATE (C.CompDate)
|
|
| 276 |
OR DATE ('0001/01/01') = DATE (C.CompDate)
|
|
| 277 |
) |
|
| 278 |
) |
|
| 279 |
Left Join chgchargedep As D |
|
| 280 |
On D.PersonCode = A.ConstrSubPersonCode |
|
| 281 |
AND ( |
|
| 282 |
DATE (D.StartDate) <= DATE ('2017/07/31')
|
|
| 283 |
AND ( |
|
| 284 |
DATE ('2016/08/01') <= DATE (D.CompDate)
|
|
| 285 |
OR DATE ('0001/01/01') = DATE (D.CompDate)
|
|
| 286 |
) |
|
| 287 |
) |
|
| 288 |
Left Join chgchargedep As E |
|
| 289 |
On E.PersonCode = A.ConstructionInstructor |
|
| 290 |
AND ( |
|
| 291 |
DATE (E.StartDate) <= DATE ('2017/07/31')
|
|
| 292 |
AND ( |
|
| 293 |
DATE ('2016/08/01') <= DATE (E.CompDate)
|
|
| 294 |
OR DATE ('0001/01/01') = DATE (E.CompDate)
|
|
| 295 |
) |
|
| 296 |
) |
|
| 297 |
Where A.ConstructionPeriod = 16 |
|
| 298 |
; |
|
| 299 |
|
|
| 300 |
Insert INTO constructionbaseinfo |
|
| 301 |
SELECT |
|
| 302 |
A.ConstructionCode |
|
| 303 |
, A.TyingFlg |
|
| 304 |
, A.JoinFlg |
|
| 305 |
, A.ConstructionYear |
|
| 306 |
, A.ConstructionPeriod |
|
| 307 |
, A.RequestedDate |
|
| 308 |
, A.EstimatesSubmitDeadline |
|
| 309 |
, A.EstimatesSubmittedDate |
|
| 310 |
, A.ProvisionalOrderDate |
|
| 311 |
, A.OrderDate |
|
| 312 |
, A.OrderStartingDate |
|
| 313 |
, A.OrderCompletionDate |
|
| 314 |
, A.PreparationStartDate |
|
| 315 |
, A.ConstructionStartingDate |
|
| 316 |
, A.ConstructionCompletionDate |
|
| 317 |
, A.NonOrderDate |
|
| 318 |
, A.OrdersDecisionPrice |
|
| 319 |
, A.OrdersDecisionPriceInTax |
|
| 320 |
, B.DepartmentCode |
|
| 321 |
, A.SalesPersonCode |
|
| 322 |
, ifnull(C.DepartmentCode, 0) |
|
| 323 |
, A.ConstructionPersonCode |
|
| 324 |
, ifnull(D.DepartmentCode, 0) |
|
| 325 |
, A.ConstrSubPersonCode |
|
| 326 |
, ifnull(E.DepartmentCode, 0) |
|
| 327 |
, A.ConstructionInstructor |
|
| 328 |
, A.TransferConstruction |
|
| 329 |
, A.TransferConstructionDate |
|
| 330 |
, A.OrderersDivision |
|
| 331 |
, A.OrderersCode |
|
| 332 |
, A.EstimatesExpirationDate |
|
| 333 |
, A.ConstructionPeriodStart |
|
| 334 |
, A.ConstructionPeriodEnd |
|
| 335 |
, A.ConstructionPeriodStart2 |
|
| 336 |
, A.ConstructionPeriodEnd2 |
|
| 337 |
, A.StartDate |
|
| 338 |
, A.EndDate |
|
| 339 |
, A.PurchaseOrderMailingDate |
|
| 340 |
, A.PurchaseOrderReturnDate |
|
| 341 |
, A.PurchaseOrderReturnCheckDate |
|
| 342 |
, A.ConsumptionTaxFlg |
|
| 343 |
, A.PrimeContractorFlg |
|
| 344 |
, A.SalesCostFlg |
|
| 345 |
, A.ConstructionStatusFlg |
|
| 346 |
, A.ConstructionType |
|
| 347 |
, A.EstimateType |
|
| 348 |
, A.BillingStartDate |
|
| 349 |
, A.BillingDate |
|
| 350 |
, A.BillingSplitFlg |
|
| 351 |
, A.BillingSendDate |
|
| 352 |
, A.LedgerComplateDate |
|
| 353 |
, InspectPlanningDate |
|
| 354 |
, InspectExecuteDate |
|
| 355 |
, RevCompleteDate |
|
| 356 |
, A.EntryDate |
|
| 357 |
, A.UpdateDate |
|
| 358 |
FROM |
|
| 359 |
constructionbaseinfo_OLD As A |
|
| 360 |
Left Join chgchargedep As B |
|
| 361 |
On B.PersonCode = A.SalesPersonCode |
|
| 362 |
AND ( |
|
| 363 |
DATE (B.StartDate) <= DATE ('2018/03/31')
|
|
| 364 |
AND ( |
|
| 365 |
DATE ('2017/08/01') <= DATE (B.CompDate)
|
|
| 366 |
OR DATE ('0001/01/01') = DATE (B.CompDate)
|
|
| 367 |
) |
|
| 368 |
) |
|
| 369 |
Left Join chgchargedep As C |
|
他の形式にエクスポート: Unified diff