sql 获取本周卖出最多的菜品,以及卖出数量
--获取本周卖出最多的菜品,以及卖出数量
select top 1 pid,COUNT(pid) as p_count from(
select * from orderdetail where datediff("ww",addtime,getdate())=0
) as bzcp --本周菜品
group by pid
order by p_count desc
--获取本周卖出最多的菜品,以及卖出数量
select top 1 pid,COUNT(pid) as p_count from(
select * from orderdetail where datediff("ww",addtime,getdate())=0
) as bzcp --本周菜品
group by pid
order by p_count desc