How to export query result in a csv file from phpmyadmin

Und alles was mit phpMyAdmin seine Verwandtschaft findet hat hier seinen Platz.

How to export query result in a csv file from phpmyadmin

Postby bashabi » 14. May 2020 00:41

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

Code: Select all
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 the result does not export. I can only export the whole database and or one table. Not the result of the query. 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?
bashabi
 
Posts: 1
Joined: 14. May 2020 00:34
XAMPP version: 7.3
Operating System: windows 10

Re: How to export query result in a csv file from phpmyadmin

Postby Nobbie » 14. May 2020 16:30

SELECT blabla
FROM blabla
WHERE blabla
INTO OUTFILE 'c:/xampp/myoutput.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';


You can specify any filename for OUTFILE, but it is a file on the webserver (not on your client PC). Keep in mind that MySQL requires certain rights to create files on the server i.e. in the folder.
Nobbie
 
Posts: 13165
Joined: 09. March 2008 13:04


Return to phpMyAdmin

Who is online

Users browsing this forum: No registered users and 26 guests