Adria Laxson Posted September 8, 2017 Share Posted September 8, 2017 Ok so I have this perfect code below (for my store) to export orders on a status basis. I've been trying to output to a txt file & always get some sort of error message about my Maria DB server. I feel I'm so close to the answer but can't seem to do it! I know I can convert the csv export to txt. I was just wanting to skip extra steps. An added bonus would be for it to export with the name "Orders.txt" *I include first name only because I import customers with first & last name together. SELECT d.id_order, os.name AS STATUS, g.id_customer, g.firstname AS customer, ad.company, ad.address1, ad.address2, ad.postcode, ad.city, ste.name AS state, cl.name AS country, ad.other, ad.phone, ad.phone_mobile, d.product_name, d.product_upc, d.product_reference, d.product_price, d.product_quantity, d.product_weight, carrier.name AS carrier, gl.name AS ship_code, o.payment, o.date_updFROM cicciabe_order_detail dLEFT JOIN cicciabe_orders oON (d.id_order = o.id_order)LEFT JOIN cicciabe_customer gON (o.id_customer = g.id_customer)LEFT JOIN cicciabe_address adON ( o.id_address_delivery = ad.id_address )LEFT JOIN cicciabe_state steON (ste.id_state = ad.id_state)LEFT JOIN cicciabe_country_lang clON (cl.id_country = ad.id_country)LEFT JOIN cicciabe_carrier carrierON ( carrier.id_carrier = o.id_carrier )LEFT JOIN cicciabe_group_lang glON ( g.id_default_group = gl.id_group )LEFT JOIN cicciabe_order_state_lang osON ( o.current_state = os.id_order_state )WHERE o.current_state = 10ORDER BY o.date_addDESC Link to comment Share on other sites More sharing options...
Scully Posted September 9, 2017 Share Posted September 9, 2017 get some sort of error message about my Maria DB server Some sort of error isn't quite precise. However the sql looks good. The export would look like this: ..... gl.name AS ship_code, o.payment, o.date_upd INTO OUTFILE '/tmp/orders.csv' FROM pre_order_detail d The database user needed special database privileges and file write permission on the selected filesystem. 1 Link to comment Share on other sites More sharing options...
Adria Laxson Posted September 11, 2017 Author Share Posted September 11, 2017 Thank you so much. Let me try that! Link to comment Share on other sites More sharing options...
Adria Laxson Posted October 6, 2017 Author Share Posted October 6, 2017 Yes, I am having a permissions problem. So essentially I just need to change chmod permissions or does it have something to do with my server? It does look like my chmod are right but I'm still looking. Link to comment Share on other sites More sharing options...
Scully Posted October 12, 2017 Share Posted October 12, 2017 Error messages always help to indentify the cause. You need two kind of permission: the select into outfile may require some permission on the database itself. Then of course the system user which runs the database must have write access to the path where you want to store the file. /tmp is a place where you usually can test such things. Link to comment Share on other sites More sharing options...
Adria Laxson Posted November 16, 2017 Author Share Posted November 16, 2017 Thank you very much for the help Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now