Excuse me, do you know how to knock out the sales and sorting codes for each product from 12 o'clock Noon to 6 o'clock in the afternoon?
Reply content:
Excuse me, do you know how to knock out the sales and sorting codes for each product from 12 o'clock Noon to 6 o'clock in the afternoon?
select goods_id , count(*) as xl from tableName where starttime>='start_time'and endtime=<'end_time' GROUP BY goods_id order by xl DESC(ASC)
命中水ヽ
Add: If you are calculating sales, sum (sales) as Sales
This is done according to your specific table, mostly SQL statements
Select sales from TableName where starttime>= start and endtime=< end order by sales DESC (ASC)
If the amount of data is larger than the proposed Time field and the Sales field index, so that the query will be faster, query statements and the previous few, there is no general difference, here does not write
You have to put the DDL on the table, just write the SQL,