Mysql_ Hangzhou November Sales of sku_20161212 not listed yesterday

Source: Internet
Author: User

#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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.