문제

Trans|Store|Date
1    | 10  |9/01/13
2    | 10  |9/01/13
3    | 20  |9/01/13
4    | 10  |9/02/13

What I am trying to query is

(For Date = 9/01/13)

Store|#Trans|Date
10   | 2    |9/01/13
20   | 1    |9/01/13

How do I achieve this any ideas ?

도움이 되었습니까?

해결책

You may try this:-

select store, count(*) as Transt from table
where Date = '9/01/13' 
group by store

다른 팁

If that doesn't do it, this might.

Select
         count(Store) as #Trans,
         Store
    from
         tablename
    where
         Date = '9/01/13'
    group by
         Store

This smells like homework something fierce though.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top