rfrunk Posted July 15, 2011 Posted July 15, 2011 I have a script to run a report for a selectable time period. It has worked just fine except this time I have to bring in "ps_customized_data.value". Linking this to the order cross's three tables and I am not sure how to get it done.Here is what I have. I have added the "ps_customized_data.value" under "Select" , " ps_customized_data" under "FROM" and the last two "AND" statements. Take out those and it works but I need to have the customized data in the report.$sql = "SELECT 'ps_orders.invoice_date','ps_orders.invoice_number','ps_customized_data.value','ps_address.firstname','ps_address.lastname','ps_address.address1','ps_address.city','ps_state.iso_code','ps_address.postcode','ps_order_detail.product_name','ps_order_detail.product_quantity','ps_order_detail.product_price' FROM ps_address, ps_orders, ps_order_detail, ps_state, ps_customized_dataUNIONSELECT ps_orders.invoice_date, ps_orders.invoice_number, ps_customized_data.value, ps_address.firstname, ps_address.lastname, ps_address.address1, ps_address.city, ps_state.iso_code, ps_address.postcode, ps_order_detail.product_name, ps_order_detail.product_quantity, ps_order_detail.product_price FROM ps_address, ps_orders, ps_order_detail, ps_state, ps_customized_data WHERE invoice_date BETWEEN '$fyr-$fmo-$fday 00:00:00' and '$tyr-$tmo-$tday 23:59:59' AND ps_address.id_address = ps_orders.id_address_delivery AND ps_state.id_state = ps_address.id_state AND ps_order_detail.id_order = ps_orders.id_order AND ps_customization.id_cart = ps_orders.id_cart AND ps_customized_data.id_customization = ps_customization.id_customization INTO OUTFILE 'C:/REPORTS/Arrow/$time' FIELDS TERMINATED BY ',' " ; Share this post Link to post Share on other sites More sharing options...
rfrunk Posted July 18, 2011 Posted July 18, 2011 Had to add in "ps_customization.id_cart" after "SELECT". Works fine now, I just get the cart id in the report now too. Share this post Link to post 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