felipe.miranda
felipe.miranda

Reputation: 21

MySQL export specific fields from multiple table into one csv file? CREATE TABLE outputs

I need to integrate my e-commerce with the local system.

I need to export specific fields from multiple tables of my database into a csv file.

I need from TABLE jos_virtuemart_products those fields product_sku , product_in_stock , low_stock_notification , product_length , product_width , product_height , product_weight

then

I need from TABLE jos_virtuemart_products_en_gb those fields purodct_name , product_s_desc

then the out put csv file should me imported to another database table that has all those fields from the others 2 table above.

Is it possible to be ran by mysql command in the linux command line? or I will have to figure out other way?

Have some one been in this situation?

Which is the best way to do this itegration?

Upvotes: 2

Views: 3331

Answers (3)

felipe.miranda
felipe.miranda

Reputation: 21

I did solve my problem with help of @Joshua Martell and what has openned my eyes was this post PHP mySQL, Joining More than Two Tables Together with Similar IDs? with the answer from @Jatin Dhoot thank y'all!

Upvotes: 0

Joshua Martell
Joshua Martell

Reputation: 7212

If you can write a query for what you want, you can use SELECT ... INTO OUTFILE to write it to a CSV file on the server. Add FIELDS TERMINATED BY to set the separator to ',' as the default is to use tabs.

http://dev.mysql.com/doc/refman/5.5/en/select-into.html

Upvotes: 1

Scott Hunter
Scott Hunter

Reputation: 49803

If you can produce a query that results in the table for the new system (probably using some kind of join), you can export THAT to a csv file.

Upvotes: 0

Related Questions