#C034杭州11月销售 SKUs that were not listed yesterday
SELECT City, A. Order date, A. Number of customers, a. Number of orders, b. Number of products, A. Amount, C. Sales confirmation, c. Gross profit, c. Gross profit margin from (SELECT City, Order date, count (user ID) as customer, SUM (order number) as order number, Sum (amount) as amount from (select City, order date, user id,count (order ID) as order number, sum (amount) as amount from (select City, date (order date) as order date, user ID, order id,sum (amount As amount from ' A003_order ' as a1where city = ' XI ' An and amount >0 and order date >=date_add (Current_date,interval-15 day) and order date <c Urrent_dategroup by order ID) as A2group by order date, user ID) as A3group by order date) as Aleft JOIN (#产品数SELECT order date, COUNT (Product ID) as product number, S UM (amount) as amount from (SELECT date (order date) as order date, product id,sum (amount) as amount from ' A003_order ' WHERE city = ' XI ' An and amount >0 and order date >=dat E_add (Current_date,interval-15 Day) and order date <current_dategroup by date (order date), Product ID) as B1group by order date) as B on a. Order date = B. Order date left JOIN (#每天毛利SELECT date (receivable) as due date, sum (sales) as sales acknowledgement, sum (gross margin) as margin, sum (gross margin)/sum (sales) as gross margin from ' a005_account ' WHERE city = ' XI ' An and receivable date >=date_add (current_date,interval-15 day) and receivable date <current_dategroup by date (receivable date)) as C on a. Order Date =c. Receivable Day
Mysql_ Hangzhou November Sales of sku_20161212 not listed yesterday