次のクエリがあります。
Select [Field], count([Field]) as Counts
from [Table_Name]
group by [Field]
結果は次のようになります。
[Field] [Counts]
Type1 100
Type2 100
Type3 100
Type4 100
Null 0
ただし、キーまたはグループ化しているフィールド以外のフィールドをカウントすると、[フィールド] Nullで実際の行数が得られます。何故ですか?
Select [Field], count([Other]) as Counts
from [Table_Name]
group by [Field]
結果:
[Field] [Counts]
Type1 100
Type2 100
Type3 100
Type4 100
Null 100