• sql查询数据并导出问题


    使用SQL语句查询数据后并导出数据表,结果订单号显示 3E+15   

    原sql: 

    SELECT
      o.order_sn AS '订单单号',
      o.order_amount AS '订单支付金额',
      o.shipping_fee AS '邮费',
      o.buyer_id AS '购买人ID',
        bm.member_mobile as '购买人手机号',
        o.order_state as '订单状态',
      bm.member_level as '会员等级',
      a.true_name AS '收货人',
      a.mob_phone AS '收货人手机号',
      o.store_name AS '店铺名称',
      DATE_FORMAT( FROM_UNIXTIME( o.add_time ), '%m月%d日%H:%i:%s' ) AS '订单生成时间',
      DATE_FORMAT( FROM_UNIXTIME( o.payment_time ), '%m月%d日%H:%i:%s' ) AS '订单支付时间',
      a.area_info AS '地区',
      a.address AS '地址',
      c.reciver_info as '客服修改的地址',
      m.manufacturer_name AS '厂家',
        o.trade_no,
      g.goods_name AS '商品规格',
        d.goods_spec as '属性',
      g.goods_num AS '商品数量',
      g.goods_price AS '商品价格',
      g.goods_pay_price AS '商品实际支付价格' ,
        c.order_message as '订单留言',
      c.deliver_explain as '发货备注',
        o.gift_type as '礼包等级',
        i.consignee_name as '真实姓名',
        i.audit_code as '身份证',
      d.goods_serial as '商家编码',
        g.gid,
        d.goods_jingle as '简介'
    FROM
      bbc_order AS o
      LEFT JOIN bbc_order_goods AS g ON o.order_id = g.order_id
      LEFT JOIN bbc_order_common AS c ON c.order_id = o.order_id
      LEFT JOIN bbc_address AS a ON c.address_id = a.address_id
      LEFT JOIN bbc_goods AS d ON g.gid = d.gid
      LEFT JOIN bbc_manufacturer AS m ON m.id = g.manufacturer_id
      LEFT JOIN bbc_member as bm on o.buyer_id = bm.member_id
    left join bbc_order_import_consignee i on o.order_id = i.order_id
    WHERE
      o.order_state in ("20") 
     and lock_state = 0;
    

      这种情况使用: CONCAT 函数将订单号输出为字符串格式就可以了

    修改后:

    SELECT
    CONCAT(o.order_sn,'') AS '订单单号',
    o.order_amount AS '订单支付金额',

    ..........

  • 相关阅读:
    Oracle数据库的非归档模式迁移到归档模式
    对Dataguard的三种模式的理解
    RMAN中建立Catalog 用数据库的例子
    Oracle中实现dblink的作法
    expdp 简单例子
    Oracle单节点_Grid_Infrastructure_DB_安装过程图解(三/三)
    Oracle单节点_Grid_Infrastructure_DB_安装过程图解(一/三)
    Oracle单节点_Grid_Infrastructure_DB_安装过程图解(二/三)
    Oracle 安装过程中 File not found "WFMLRSVCApp.ear" 的原因
    基于Django的在线考试系统
  • 原文地址:https://www.cnblogs.com/yszr/p/13511554.html
Copyright © 2020-2023  润新知