[dba-SQLServer] summing in a crosstab

jwcolby jwcolby at colbyconsulting.com
Mon Nov 12 10:01:12 CST 2007


I am doing a count like this
	10 11 12 13 14 15 16 17 etc
AK
AL
AR
AZ

This is by state, by boat length.  However the user wants the boat lengths
grouped, i.e. a single column for 10-15, 15-20 etc. where I have summed the
counts for 10,11,12,13,14, and 15 and display that in a single column.  Is
this possible in a single query or am I going to have to go to a separate
query to sum the lengths by state and then add that in to the crosstab
somehow?

John W. Colby
Colby Consulting
www.ColbyConsulting.com 




More information about the dba-SQLServer mailing list