![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#1
IP: 112.87.93.182
|
|||
|
|||
|
This mysql query can be used in phpMyAdmin or as part of a PHP script to evaluate your X-Cart product database and determine the numbers of sales a product has generated along with the first and last purchase dates.
This information can be very useful for determining which products you may want to put more marketing focus on, and those which you may want to shelve altogether. Code:
SELECT p.productid, p.product, COUNT( od.orderid ) AS sales, FROM_UNIXTIME( MIN( o.date ) , '%Y %M %e' ) AS first_order, FROM_UNIXTIME( MAX( o.date ) , '%Y %M %e' ) AS last_order FROM xcart_products AS p LEFT JOIN xcart_order_details AS od ON p.productid = od.productid LEFT JOIN xcart_orders AS o ON o.orderid = od.orderid WHERE p.forsale = 'Y' GROUP BY od.productid ORDER BY sales DESC , p.productid DESC |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Get Your Monthly Zen Cart Sales With Just One Line of Code | Quail Valley | ZenCart | 0 | 2014-07-24 09:32 AM |
| How to Install an Zen Cart Template | topvip | ZenCart | 0 | 2009-08-23 05:35 PM |
| X-Cart Multiple Input Validation Holes Permit SQL Injection and Cross-Site Scripting | topvip | X-Cart | 0 | 2009-07-21 10:03 AM |
| x-cart Template Editing Guide for 4.1.x | topvip | X-Cart | 0 | 2009-04-15 11:42 PM |
| 跟我学sql:(二) Select语句选项 | topvip | 建站交流 | 0 | 2009-02-12 07:42 AM |