1 select top 200 * from tblShopSalesHistory (查询该表的前200记录的所有内容)
2 select TOP 200 [month],sum(sumAmt) as sumAmt group by Month Order by Month DESC (该表记录按月份分组,查询前200记录的月份,每一月份的总销售额)
3 Select h.Month, sum(SumAmt) sumamt, tblShopSalesHistory h , tblItemmas i Where h.PLU = i.PLU And SubString(shopcode,1,2) IN ('RC', 'SH', 'TK', 'TJ', 'TS') group by Month Order by Month DESC
表一按月份分组,查询前200记录的月份,每一月份的总销售额,但是表1的货品编号必须是表2中已经定义过的货品编号,并且表1的店铺编号前缀必须在 ('RC', 'SH', 'TK', 'TJ', 'TS') 中
4 select TOP 200 [month],sum(sumAmt) as sumAmt,IsNull(sum(Case When group2 = 'SCHESIR' Then SumAmt Else 0 End),0) SCHEAmt from tblShopSalesHistory h, tblItemmas i Where h.PLU = i.PLU And SubString(shopcode,1,2) IN ('RC', 'SH', 'TK', 'TJ', 'TS') group by Month Order by Month DESC
表一按月份分组,查询前200记录的月份,每一月份的总销售额,同一月份品牌为“'SCHESIR'”的销售额汇总,但是表1的货品编号必须是表2中已经定义过的货品编号,并且表1的店铺编号前缀必须在 ('RC', 'SH', 'TK', 'TJ', 'TS') 中