mysql將查詢到的資料匯出為excel,mysqlexcel

來源:互聯網
上載者:User

mysql將查詢到的資料匯出為excel,mysqlexcel

   現在需要將mysql庫中的一些資料匯出為excel,然後列印。其實實現上面說的需求很簡單,只要你把sql語句寫出來,然後匯出為excel即可

具體實現流程如下:

1、寫出sql語句,查詢出結果。

2、在查詢的結果上點擊右鍵,選擇“匯出所有表資料記錄/結果為...”

選擇“匯出所有表資料記錄/結果為...”之後出現如所示

點擊匯出即可。


========================================================

需要注意一小點,select後面的欄位用一下as成漢字更好,這樣的話表格標題就是漢字了。


mysql把查詢到的資料自動導成excel

SELECT * INTO OUTFILE ‘./test.xls‘ FROM tb1 WHERE 1 ORDER BY id DESC ;
 
mysql把查詢到的資料自動導成excel

SELECT * INTO OUTFILE ‘./test.xls‘ FROM tb1 WHERE 1 ORDER BY id DESC ;
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.