Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 06, 2010 11:04 AM by adeelehsan
Mar 05, 2010 05:06 PM|LINK
I have a query that returns a field called Type. Possible values for Type are A, B, C, or Unknown. I want to create a table that will show the number of rows of each Type but not the not the Unknown type. Also I like the table to show the percentage of
known types versus total types. So the table show look like this:
A number of rows with A Type
B number of rows with B Type
C number of rows with C Type
Total: (number of rows with A, B, or C Types / number of all rows with A, B, C, or Unknown Types)
Please someone tell me how to do this in Visual Studio 2005 reports. Thank you.
Mar 06, 2010 10:47 AM|LINK
Use the following query which will give you 2 columns data:
select types.[type],count(*) as total from
types where type!='UNKNOWN'
group by type
Mar 06, 2010 11:04 AM|LINK
I have modified the my previous posted query. Use the following query to fetch and display the data on the report. This will give you:
select types.[type],count(*) as total,
convert(decimal,count(*))/convert(decimal,t.tall)*100 as percentage from
types,(select count(*) as tall from types) as t where type!='UNKNOWN'
group by type,t.tall