Stumped on a query


i hoping can me.  it has been long since have had other simple queries in sql struggling solve problem. 

 

let’s have table 1 column named fileextensions, , values in column follows:

 

.pdf

.docx

.pptx

.pdf

.docx

.pptx

.pdf

.docx

.pptx

 

 

.pdf

.pdf

.pdf

.docx

.docx

.pptx

 

i need write query give me following summary results showing how many of each file extension present in column:

 

fileext                  count

.pdf                             6

.docx                          5

.pptx                           4

 

 

the example above simplification of need because can't use hard coded values for extensions in statement because not known in advance.

 

 

any ideas?

select fileext, count)fileext) ct

from tablename

group fileext

please aware ssrs forum rather sql queries forum


rgds geoff


SQL Server  >  Transact-SQL



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'