运行SQL语句加上order by什么结果都不出来,去掉就查询出来了,
SELECTcompany_name,store_name,tenant_name,booth_type_name,product_name,category_name,...
SELECT company_name,store_name,tenant_name,booth_type_name,product_name,category_name,product_price,ROUND(SUM(product_money),2) as sale_money,ROUND(COUNT(product_num),0) as total, MAX(product_money) as max_money,MIN(product_money) as min_money,ROUND(SUM(product_num),2) AS sale_total,product_unit FROM(
SELECT B.company_name,B.tenant_name,B.booth_type_name,B.store_name,A.product_name,A.category_name,A.product_price,A.product_num,A.product_money,A.product_unit
from v_order_item as A LEFT JOIN v_order as B ON B.id= A.order_id WHERE (B.order_status =1 OR (B.order_status=0 AND B.pay_way=5)) AND B.order_from = 2 and B.store_id = 3 AND B.create_time BETWEEN '2019-6-1 00:00:00' AND '2019-7-1 23:59:59'
) a GROUP BY product_name ORDER BY sale_money DESC limit 0, 30 展开
SELECT B.company_name,B.tenant_name,B.booth_type_name,B.store_name,A.product_name,A.category_name,A.product_price,A.product_num,A.product_money,A.product_unit
from v_order_item as A LEFT JOIN v_order as B ON B.id= A.order_id WHERE (B.order_status =1 OR (B.order_status=0 AND B.pay_way=5)) AND B.order_from = 2 and B.store_id = 3 AND B.create_time BETWEEN '2019-6-1 00:00:00' AND '2019-7-1 23:59:59'
) a GROUP BY product_name ORDER BY sale_money DESC limit 0, 30 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询