mysql - SQL to find the top selling product in April -
i need find top selling product in april database. have 2 tables called sales , salesline.
the sales table includes each sales throughout year , salesline table includes each product sold in each sale.
sales table includes following:
sale_id payment_id ship_id sales_total date time cusotomer_id the salesline table includes:
salesline_id product_id saleprice sale_id payment id thanks
try this:
if want check no of quantity sold:
select product_id, count(product_id) salesline sale_id in (select sale_id sales date between '2013-04-01' , '2013-04-30') group product_id
Comments
Post a Comment