select * from (
select cast(t1.`person_id` as char(36) charset utf8) AS `teacher_id`,
t1.`identity_id` AS `identity_id`,
t1.`id_int` AS `id_int`,
t1.`xm` AS `xm`,
t1.`xmpy` AS `xmpy`,
t1.`cym` AS `cym`,
t1.`xbm` AS `xbm`,
t1.`csrq` AS `csrq`,
t1.`mzm` AS `mzm`,
t1.`zzmmm` AS `zzmmm`,
t1.`sfzjlxm` AS `sfzjlxm`,
t1.`sfzjh` AS `sfzjh`,
t1.`xlm` AS `xlm`,
t1.`xwm` AS `xwm`,
t1.`zcm` AS `zcm`,
t1.`bzlbm` AS `bzlbm`,
t1.`stage_id` AS `stage_id`,
t1.`subject_id` AS `subject_id`,
t1.`gwzym` AS `gwzym`,
t1.`lxdh` AS `lxdh`,
t1.`dzxx` AS `dzxx`,
t1.`b_use` AS `b_use`,
t1.`state_id` AS `state_id`,
t2.bureau_id,
DATE_FORMAT(t1.`last_updated_time`,'%Y/%m/%d %H:%i:%s') AS `last_updated_time`,
DATE_FORMAT(t1.`cjny`,'%Y/%m/%d %H:%i:%s') AS `cjny`,
DATE_FORMAT(t1.`create_time`,'%Y/%m/%d %H:%i:%s') AS `create_time`,
case t1.`b_use` when -2 then 1 else 0 end AS `del_flag`,
`t_base_organization`.`main_school_type` AS `main_school_type`,
`t_base_organization`.`xxbxlxm` AS `xxbxlxm`,
`t_base_organization`.`szdcxlxm` AS `szdcxlxm`
from (`t_base_teacher` as t1 inner join `t_base_teacher_org` as t2 on t1.person_id=t2.person_id and t2.b_use=1 and t2.is_main=1 join `t_base_organization` on (t2.`org_id` = `t_base_organization`.`org_id`))
where t1.identity_id=2
) as t1