大网数据广告活动
网站运营与故障问答

How to export query result in a csv file from phpmyadmin

· 52CE 我爱测

I am running a query in PHPMyAdmin. The query is fine. it's showing the correct result. I want to export that result in a CSV file. It's not on the local server. It's on the webserver This is my query SELECT notices.id, notices.g…

问题原文

原帖链接 · Bashabi · CC BY-SA 4.0

I am running a query in PHPMyAdmin. The query is fine. it's showing the correct result.

I want to export that result in a CSV file. It's not on the local server. It's on the webserver

This is my query

SELECT notices.id, notices.gazette_notice_id, notices.notice_code, notices.company_number, notices.publication_date, companies.company_name, companies.registered_address_town, companies.registered_address_postcode, companies.sic_1, sic_codes.description, sic_codes.division, sic_codes.section, insolvency_practitioners.name as practionar_name, insolvency_practitioners.company as practitioner_company, insolvency_practitioners.address as prac_address, insolvency_practitioners.phone  FROM notices
LEFT JOIN companies ON notices.company_number = companies.company_number 
LEFT JOIN sic_codes ON companies.sic_1 = sic_codes.code
LEFT JOIN notice_insolvency_practitioners ON notices.id = notice_insolvency_practitioners.notice_id 
LEFT JOIN insolvency_practitioners ON notice_insolvency_practitioners.insolvency_practitioner_id = insolvency_practitioners.id
Where notices.publication_date >'2020-05-01' and notices.publication_date < '2020-05-31'

In the phpmyadmin window at the bottom of the result pane, I can see an export link. but if I click on export that allows me only to export the notice table not the result.

I don't want to create a frontend window for it. just want to export the result in CSV file from PHPMyAdmin

I have checked the questions in here

https://stackoverflow.com/questions/6239956/generate-csv-based-on-mysql-query-from-phpmyadmin

and here

https://stackoverflow.com/questions/356578/how-to-output-mysql-query-results-in-csv-format?page=1&tab=votes#tab-top

But I have confusion understanding the answers. Cause I am running this query in remote webserver and want to download the file in local machine. And don't want to create any new table for that.

How to export the result in csv file?

已采纳解答

原帖链接 · g0h · CC BY-SA 4.0

Previously answered correctly here: https://serverfault.com/a/435443

The answer:

  1. Execute your sql query in the SQL tab of phpMyAdmin.

  2. After execution, scroll down the page and look for “Query results operations”

  3. Click “Export” link from the above and you will get the page to export all the results of the queries to desired format. That’s it.

Note: The resulting Export page has 'Dump all rows' Selected, but it actually only exports the results of your query. - This can cause confusion (phpMyAdmin 4.9.4).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2020-05-13)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。