Through much wailing and gnashing of teeth, I'm not a mysql expert as the code below will confirm...
Anyway, I have a client that needs a monthly 'sales and use' report. She created an example excel worksheet with the fields she wanted. Here's what I came up with:
I am rather convinced there is a more elegant solution. I'm also hoping to put this in a shell script that will put a date range in and have cron run it once a month to produce an .xls. I used phpmyadmin to execute and export the file. It works for me. Let me know what you think!Code:SELECT zen_orders.customers_name, zen_orders.date_purchased, zen_orders_total.text AS subtotal, shipping_source.text AS shipping, shipping_source.title AS shipping_method,zen_orders.order_tax, zen_orders.order_total FROM zen_orders, zen_orders_total LEFT JOIN zen_orders_total AS shipping_source ON zen_orders_total.orders_id = shipping_source.orders_id WHERE zen_orders_total.title LIKE 'Sub%' AND shipping_source.title LIKE 'Unit%' AND zen_orders.orders_id = zen_orders_total.orders_id



