Trans|Store|Date
1 | 10 |9/01/13
2 | 10 |9/01/13
3 | 20 |9/01/13
4 | 10 |9/02/13
我想要查询的是
(日期= 9/01/13)
Store|#Trans|Date
10 | 2 |9/01/13
20 | 1 |9/01/13
我如何实现这一点?
答案 0 :(得分:1)
你可以试试这个: -
select store, count(*) as Transt from table
where Date = '9/01/13'
group by store
答案 1 :(得分:0)
如果不这样做,可能会这样做。
Select
count(Store) as #Trans,
Store
from
tablename
where
Date = '9/01/13'
group by
Store
这就像家庭作业一样凶狠。