count occurence of string? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

count occurence of string?

Does anyone know of a function I can use for the following: I have a column with order numbers as strings. the order numbers can occur more than once in the column. I want to get a count of how many times each order number occurs.
Select orderNumber, count of times this order number occurs from table??
Select Sorder, count (*)
from SalesOrders
group by Sorder this seems to work.