Total Number Of Some Column


SELECT COUNT(SomeColumnName) FROM SomeTable WHERE ...
SELECT SomeColumnName, COUNT(SomeColumnName) FROM SomeTable WHERE ... GROUP BY SomeColumnName

	//You can read it like this
	TotalVideosInSection = Convert::ToInt32(Row[0]);

Total Number Of Rows


SELECT COUNT(*) FROM SomeTable WHERE ...

Sum Of Some Column


SELECT SUM(SomeColumnName) FROM SomeTable WHERE ...

Total Number Of True


SELECT SUM(CONVERT(int, SomeBoolColumnName)) FROM SomeTable

Total Number Of False


SELECT COUNT(SomeBoolColumnName)-SUM(CONVERT(int, SomeBoolColumnName)) FROM SomeTable

Grouping Results

Use GROUP BY

UK Electronic Designer
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published.