
drop view v_grade_subsidy_batch;
create view v_grade_subsidy_batch as
select `t1`.`id`                    AS `batchId`,
       `t1`.`applyTime`             AS `applyTime`,
       `t1`.`batchName`             AS `batchName`,
       `t1`.`approvalstate`         AS `approvalstate`,
       `t1`.`approvaldate`          AS `approvaldate`,
       `t3`.`id`                    AS `id`,
       `t3`.`active`                AS `active`,
       `t3`.`updateflag`            AS `updateflag`,
       `t3`.`used`                  AS `used`,
       `t3`.`create_time`           AS `create_time`,
       `t3`.`update_time`           AS `update_time`,
       `t3`.`update_by`             AS `update_by`,
       `t3`.`areaCode`              AS `areaCode`,
       `t3`.`gradeId`               AS `gradeId`,
       `t3`.`orgId`                 AS `orgId`,
       `t3`.`trainId`               AS `trainId`,
       `t3`.`trainName`             AS `trainName`,
       `t3`.`companyId`             AS `companyId`,
       `t3`.`companyName`           AS `companyName`,
       `t3`.`orgName`               AS `orgName`,
       `t3`.`name`                  AS `name`,
       `t3`.`idNum`                 AS `idNum`,
       `t3`.`phone`                 AS `phone`,
       `t3`.`sex`                   AS `sex`,
       `t3`.`residentNature`        AS `residentNature`,
       `t3`.`residentPlace`         AS `residentPlace`,
       `t3`.`contractStartTime`     AS `contractStartTime`,
       `t3`.`contractEndTime`       AS `contractEndTime`,
       `t3`.`subsidyType`           AS `subsidyType`,
       `t3`.`subsidyPeopleType`     AS `subsidyPeopleType`,
       `t3`.`socialCode`            AS `socialCode`,
       `t3`.`trainProfession`       AS `trainProfession`,
       `t3`.`trainGrade`            AS `trainGrade`,
       `t3`.`classHour`             AS `classHour`,
       `t3`.`certificateType`       AS `certificateType`,
       `t3`.`certificateNumber`     AS `certificateNumber`,
       `t3`.`certificateProfession` AS `certificateProfession`,
       `t3`.`certificateGrade`      AS `certificateGrade`,
       `t3`.`completeMoney`         AS `completeMoney`,
       `t3`.`completeMoneyRate`     AS `completeMoneyRate`,
       `t3`.`appraisalMoney`        AS `appraisalMoney`,
       `t3`.`appraisalMoneyRate`    AS `appraisalMoneyRate`,
       `t3`.`subsidyMoney`          AS `subsidyMoney`,
       `t3`.`subsidyMoneyRate`      AS `subsidyMoneyRate`,
       `t3`.`remark`                AS `remark`,
       `t3`.`subsidyStatus`         AS `subsidyStatus`,
       `t3`.`reason`                AS `reason`,
       `t3`.`completeCerNo`         AS `completeCerNo`,
       `t3`.`completeCerDate`       AS `completeCerDate`,
       `t3`.`cerNo`                 AS `cerNo`,
       `t3`.`cerDate`               AS `cerDate`,
       `t3`.`certificateDate`       AS `certificateDate`,
       `t3`.`trainBeginDate`        AS `trainBeginDate`,
       `t3`.`trainEndDate`          AS `trainEndDate`,
       `t3`.`inAppraisal`           AS `inAppraisal`,
       `t3`.`subsidyCerType`        AS `subsidyCerType`,
       `t1`.offApprovalState        AS offApprovalState
from ((`sb_grade_subsidy_batch` `t1` join `sb_grade_subsidy_batch_roster` `t2` on ((`t1`.`id` = `t2`.`batchId`)))
         join `grade_subsidy_roster` `t3` on ((`t2`.`rosterId` = `t3`.`id`)));