• linux mysql数据导出


    一、登录数据库服务器

    二、导出语句格式

        mysql 数据库  -u用户  -p密码  -e  "select   *   from   xx.yy"   >   d:/test.xls

       

     mysql jlt2  -uroot  -pkiller  -e  "SELECT 
    	WmsOrderBase.order_sn, 
            SaleOrder.order_sn AS sale_order_sn,
    	WmsOrderBase.type_id, 
    	WmsOrderBase.consignee_name, 
    	WmsOrderBase.consignee_phone, 
    	WmsOrderBase.consignee_address, 
    	WmsOrderBase.house_id, 
    	WmsHouse.house_name, 
    	WmsOrderBase.province_id, 
    	WmsOrderBase.city_id, 
    	WmsOrderBase.country_id, 
    	Province.region_name AS ProvinceName, 
    	City.region_name AS CityName, 
    	County.region_name AS CountyName, 
    	WmsOrderItem.sku_id, 
    	WmsOrderItem.goods_id, 
    	WmsOrderItem.sku_name, 
    	WmsOrderItem.sku_num, 
    	WmsOrderItem.space_id, 
    	WmsHouseSpace.space_name 
    
    FROM 
    	wms_order_base AS WmsOrderBase 
    	LEFT JOIN wms_order_item AS WmsOrderItem ON WmsOrderItem.order_id = WmsOrderBase.order_id 
    	LEFT JOIN wms_house AS WmsHouse ON WmsHouse.house_id = WmsOrderBase.house_id 
    	LEFT JOIN wms_house_space AS WmsHouseSpace ON WmsHouseSpace.space_id = WmsOrderItem.space_id 
    	LEFT JOIN global_region AS Province ON Province.region_id = WmsOrderBase.province_id 
    	LEFT JOIN global_region AS City ON City.region_id = WmsOrderBase.city_id 
    	LEFT JOIN global_region AS County ON County.region_id = WmsOrderBase.country_id 
       LEFT JOIN sale_order AS SaleOrder ON SaleOrder.order_id = WmsOrderBase.out_order_id 
    WHERE 
    	WmsHouse.master_id >= 90"  >  /home/u.txt
    

    三、cd  /home目录下(语句哪儿选择的那个目录就进入那个目录)

     四、 sz 文件名字   eg:sz u.txt  

      桌面或者其他(sz 时选择的路径)就有个u.txt文件

    五、  把u.txt弄成excel文件

          

    有些字段数字很长 会是科学计数法 变成excel格式后再转换成文本数据会错误  这儿要选择下成文本

    然后修改 另存为就OK了

     

  • 相关阅读:
    python字符串
    python定义多点坐标_绘制折线_计算起始点和终点
    python进制转化
    python画奥运五环
    python的注释方法行连接符
    python的命名和帮助命令查看关键字
    python的turtle模块画图
    汇编语言
    python自动化办公【第三节 判断语句】
    python自动化办公【第二节 运算及数据类型等【不断修订中】】
  • 原文地址:https://www.cnblogs.com/sanqiyi/p/7250919.html
Copyright © 2020-2023  润新知