订单数据同步
- 表结构
insert into tbl_order_new
(
ordernum , name , gender, age , birthday,
idcard , marriagestatus, mobile , onlinepaymoney, hiscompid ,
hiscompname, myexamdate, upload, inserttime , uploadtime,
hisexamineenum, ordermoney, examperiod, address , mealclassifyname ,
receiptstatus, handlereceipttime , arrivalstatus, handlearrivaltime,healthnum,
healthlevel, employeeid, department, addaccounttype, ordercreatetime,
remark, examcompany, companyid, offlinepaymoney, vip,
mymealid , mealname, paytype, guidestatus, handleguidetime)
select
ORDER_NUM,NAME,GENDER,AGE,BIRTHDAY,
IDCARD,MARRIAGE_STATUS,MOBILE,ONLINE_PAY_MONEY,HIS_COMPANY_CODE,
HIS_COMPANY_NAME,'','',IMPORT_TIME,'',
HIS_BM,ORDER_MONEY,'','','',
0,'',0,'',HEALTH_NUM,
HEALTH_LEVEL,WORKNO,DEPARTMENT,'',IMPORT_TIME,
REMARK,EXAM_COMPANY_NAME,EXAM_COMPANY_CODE,OFFLINE_PAY_MONEY,IS_VIP,
MEAL_CODE,MEAL_NAME,FEE_TYPE,0,''
from tbl_order where rownm<2
insert into tbl_order_new_item
( ordernum ,hisid,originalprice,price,typetomeal)
select
b.order_num,ITEM_CODE,ITEM_INIT_PRICE,ITEM_DISCOUNT_PRICE,
case ITEM_TYPE when '套餐项目' then 1 when '增加' then 3 else 2 end as typetomeal
from tbl_order_item a left join tbl_order b on a.order_id = b.id where b.order_num in (select ordernum from tbl_order_new)
- 存储过程
升级
文档更新时间: 2023-05-05 14:26