advert.sql 10.7 KB
CREATE TABLE `im_advert` (
  `im_advert_id` varchar(36) NOT NULL COMMENT '积分商城广告ID',
  `type_id` tinyint(4) NOT NULL COMMENT '类型ID',
  `im_product_id` varchar(36) not null comment '关联的产品ID',
  `name` varchar(254) NOT NULL COMMENT '广告名称',
  `image_url` varchar(254) NOT NULL COMMENT '广告图片',
  `is_show` tinyint(4) NOT NULL DEFAULT '1' COMMENT '是否显示在首页',
  `sort_index` int(11) NOT NULL COMMENT '排序号',
  `create_member_id` varchar(36) NOT NULL COMMENT '创建人',
  `create_dt` datetime NOT NULL COMMENT '创建时间',
  `update_dt` datetime DEFAULT NULL COMMENT '结束时间',
  `delete_flag` tinyint(4) NOT NULL DEFAULT '1' COMMENT '删除标识',
  PRIMARY KEY (`im_advert_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


select * from ( select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_00 do left join im_doing_order1_00 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_01 do left join im_doing_order1_01 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_02 do left join im_doing_order1_02 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_03 do left join im_doing_order1_03 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_04 do left join im_doing_order1_04 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_05 do left join im_doing_order1_05 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_06 do left join im_doing_order1_06 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_07 do left join im_doing_order1_07 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_08 do left join im_doing_order1_08 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_09 do left join im_doing_order1_09 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_10 do left join im_doing_order1_10 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_11 do left join im_doing_order1_11 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_12 do left join im_doing_order1_12 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_13 do left join im_doing_order1_13 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_14 do left join im_doing_order1_14 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 UNION ALL select do.order_id,do.order_code,do.order_status,do.order_from, do.contact,do.phone,do.address,do.zipcode,do.total_integral,do.total_money, do.freight,do.create_dt,do.pay_dt,do.pay_type,do.transaction_id,do.erp_import, do.erp_import_dt,do.buyer_username,do.buyer_phone, do1.purchase_quantity,do1.shipped_quantity,do1.integral,do1.line_integral,do1.price,do1.line_price, p.name,p.erp_code from im_doing_order_15 do left join im_doing_order1_15 do1 on do.order_id=do1.order_id left join sibu_integralmall_base.im_product p on do1.product_id = p.im_product_id where do.delete_flag = 1 and do.order_from =1 and do.order_status =3 ) as temp