2017-08-28 3 views
-5

私はカテゴリのリストを持っていますが、私はselect distinctステートメントを使用することができますが、カテゴリが何回使用されたのかを調べるのに苦労します。Descriptionというカラムがあり、SELECT DISTINCTクエリの作成方法

Description 
------------- 
Arts, crafts, and collectibles 
Baby 
Beauty and fragrances 
Books and magazines 
Business to business 
Clothing, accessories, and shoes 
Computers, accessories, and services 
Education 
Electronics and telecom 
Entertainment and media 
Financial services and products 
Food retail and service 
Gifts and flowers 
Government 
Health and personal care 
Home and garden 
Nonprofit 
Pets and animals 
Religion and spirituality (for profit) 
Retail (not elsewhere classified) 
Services - other 
Sports and outdoors 
Toys and hobbies 
Travel 
Vehicle sales 
Vehicle service and accessories 
Books and magazines 
Business to business 
Clothing, accessories, and shoes 
Computers, accessories, and services 
Education 
Electronics and telecom 
Entertainment and media 
Financial services and products 
Food retail and service 
Gifts and flowers 
Government 
Health and personal care 
Services - other 
Sports and outdoors 
Toys and hobbies 
Travel 
Vehicle sales 
Vehicle service and accessories 
Books and magazines 
Business to business 
Clothing, accessories, and shoes 
Business to business 
Clothing, accessories, and shoes 
Computers, accessories, and services 
Education 
Electronics and telecom 
Entertainment and media 
Financial services and products 
Food retail and service 
+3

https://stackoverflow.com/help/how-to-ask –

+1

あなたは私達にあなたのクエリを表示 – Hackerman

+0

by' '回数(1)'と 'グループの組み合わせを使用して正確に説明することができますしてくださいこれを読んでなぜアウトプットはあなたが望むものではないのか、あなたのクエリーがそれを生み出すと思ったのはなぜであろう。 – csmckelvey

答えて

3

これは単純な集約のようです。

Select 
    [Description] 
    ,Occurences = Count([Description]) 
From 
    YourTable 
Group By 
    [Description] 
+0

これは機能しません。ご協力いただきました – AfricanHeart

+6

ちょうどあなたが尋ねたもの。おそらく、あなたが求めたものは、あなたが必要とするものではありません。それはなぜ機能しないのですか? – scsimon

+0

これはクールで、私はあなたが 'エイリアス= COUNT(列)'を行うことができるかどうかはわかりませんでした。エイリアスとしてCOUNT(列)に対抗するのと同等の差異はありますか? – Simon

関連する問題