0

I am working out of phpmyadmin to export data using an sql.

I have an 88 table database. I would like to export all data to a .csv from 85 of those tables where I am only keeping the rows in which my column Length(Status)> 0.

So far I've come up with being able to select all data from a single table. I would like to apply to my entire database except the 3 tables and export it a .csv.

SELECT * FROM table WHERE LENGTH(Status)> 0

asked Jan 22, 2019 at 20:00

2 Answers 2

1

Use SELECT INTO OUTFILE ... WHERE LENGTH(Status)> 0 for each table.

PHPMyAdmin isn't a tool for complex tasks.

answered Jan 22, 2019 at 22:32
1
SELECT
 CONCAT("SELECT INTO OUTFILE ... FROM ", table_name, " WHERE ...")
 FROM information_schema.tables
 WHERE table_name NOT IN ("not_me_1", "not_me_1", "not_me_1")
 AND schema_name = "my_database_name";

That will generate 85 SELECT statements. Copy/paste them into the phpadmin screen that lets you run arbitrary commands.

(And consider learning to use the mysql commandline tool.)

What kind of values do you have in status? LENGTH(Status) > 0 seems like a strange test. Also, beware of NULL values; learn about IS NULL.

answered Jan 23, 2019 at 17:42

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.