日期:2014-05-17 浏览次数:20538 次
select a.书名, SUM(c.数量) from (tb_book a inner join tb_sell_sub c on a.条形码 = c.条形码) \
inner join tb_sell_main b on c.销售单号 = b.销售单号 \
group by a.条形码, a.书名 \
having b.时间 between '2013/2/6' and '2013/5/21' order by SUM(c.数量) desc
SELECT a.书名 ,
SUM(c.数量)
FROM ( tb_book a
INNER JOIN tb_sell_sub c ON a.条形码 = c.条形码
)
INNER JOIN tb_sell_main b ON c.销售单号 = b.销售单号
WHERE b.时间 BETWEEN '2013/2/6' AND '2013/5/21'
GROUP BY a.条形码 ,
a.书名
ORDER BY SUM(c.数量) DESC