Sql Function To Count Number Of Rows With Same Value