In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about how to export query data to EXCEL files under the MYSQL5.1 WINDOWS environment, which may not be well understood by many people. In order to make you understand better, the editor summarizes the following contents for you. I hope you can get something according to this article.
Today to do a multi-table joint query, using myadmin does not support export, so find the following method, good!
Query out the records, export to the EXCEL file, directly do the report output.
Test environment WINDOWS XP,OFFICE 2003 MYSQL 5.1.45
1: create a test table with 3 fields, including 2 Chinese fields, for demonstration using mysql > create table tt (an int (11) not null,b varchar (30), c varchar (30))
Query OK, 0 rows affected (0.00 sec)
Mysql > insert into tt values (1BI 'Beijing', 'Peking University'), (2 'Shanghai', 'Shanghai University'), 3 'Shenzhen', 'Shenzhen University')
Query OK, 3 rows affected
Records: 3 Duplicates: 0 Warnings: 0
2: export to an EXCEL file, using the OUTFILE method, the following two methods have the same effect
Mysql > select BBJ c from tt into outfile'c:\ xls_tt.xls'
Query OK, 3 rows affected (0.00 sec)
Mysql > select BBJ c into outfile'c:\ xlstt.xls' from tt
Query OK, 3 rows affected (0.00 sec)
3: find the exported XLS file under disk C and find that it is all garbled, such as
If you don't know what to say, you'll have to pay for it.
Trickle-down, trickle-down.
Bian and Bian, Bian and Bian
This is completely impossible to use. "at this time, the file is utf-8 encoded, opened with excel, garbled.
Open test.xls as text, then save as, select ANSI to encode, save ". After doing this, there will be no garbled code, but you need to deal with it manually. Look at other ways.
4: with the help of online friends, find the following conversion methods
Mysql > select convert (b using gb2312), convert (c using gb2312) into outfile'c:\ xlstt12.xls' from tt
Query OK, 3 rows affected (0.00 sec)
Open the exported file and everything is fine.
The default encoding method of EXCEL is GB2312. After the query field is converted to 312, the two sides agree, so there is no garbled code.
After reading the above, do you have any further understanding of how to export query data to EXCEL files in MYSQL5.1 WINDOWS environment? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.