0

I want to export query result in to CSV file from PHPMyAdmin

How to do that?

See the below picture. Normally I can see the option to check all, edit and delete rows.

enter image description here

But when I run this query

SELECT n.id
     , n.gazette_notice_id
     , n.notice_code
     , n.publication_date
     , n.company_number
     , c.company_name
     , c.registered_address_line_1
     , c.registered_address_line_2
     , c.registered_address_town
     , c.registered_address_county
     , c.registered_address_country
     , c.registered_address_postcode
     , c.sic_1
     , s.description sic_code_description
     , s.division sic_code_division
     , s.section sic_code_section
     , ni.insolvency_practitioner_id     
     , i.name practionar_name
     , i.company practitioner_company
     , i.address practitionar_address
     , i.phone   
     , i.email  
  FROM notices n
  LEFT
  JOIN companies c
    ON c.company_number = n.company_number
  LEFT 
  JOIN sic_codes s
    ON s.code = c.sic_1 
  LEFT
  JOIN notice_insolvency_practitioners ni
    ON ni.notice_id = n.id 
 LEFT
  JOIN insolvency_practitioners i
    ON i.id = ni.insolvency_practitioner_id 
 WHERE n.publication_date > '2020-03-01' 
   AND n.publication_date < '2020-03-31'
   AND n.notice_code = 2410

The option just disappears and I get this message warning

Current selection does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available.

enter image description here

And if you click on export without selecting the rows then it will export the table. But I don't want to export one single table. I have created query to select data from 5 tables.

Please guide me how to export query result into excel /csv file.

1

The warning explains it all. None of the columns you are trying to join are unique which means there is a possible ambiguity in the statement. i.e.

JOIN notice_insolvency_practitioners ni ON ni.notice_id = n.id

Because the columns aren't unique, there can be more than one identical value for n.id or ni.notice.id (or maybe others, it is impossible to tell from here).

Add some unique indexes to your database tables, one on each of the columns you are referencing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.