Count of same row

Hi,

I want to know if there are function to return count of the same row data in DataTable

Example

City, Name
New York, Paul
Boston, Catherine
New York, Cathy
New York, Debby

I want the number of city
In this example, the answer is two (New York, Boston)
GIPAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy PooleCommented:
Well you can query the table via SQL:
Select city,count(city) from yourtable group by city

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Shaun KlineLead Software EngineerCommented:
You can use the DataView.ToTable() function.
This link is to the overload that will only add distinct values to the new table based on the selected columns:
http://msdn.microsoft.com/en-us/library/wec2b2e6(v=vs.110).aspx
0
GIPAuthor Commented:
I decided to use a second table in my SQL query to return my value

Shaune thank you for your answer too.

SELECT COUNT(Distinct NomFamille) From #TempCommandeExcel

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.