Click here to Skip to main content
16,021,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i got datatable WITH ONLY 1 COLUMN
say
companyname
A
B
C
A
D
B


Now i want to get a distinct count from that datatable

Pls help..
Posted
Updated 13-Oct-11 20:28pm
v2

Use the following query:
SQL
select count(companyname), companyname from tablename group by companyname
 
Share this answer
 
Comments
Pravin Patil, Mumbai 14-Oct-11 2:41am    
+5 correct answer..
Mehdi Gholam 14-Oct-11 2:42am    
Thanks
use like below
SQL
SELECT DISTINCT companyname from TABLE


SQL
SELECT  COUNT(DISTINCT companyname) from TABLE
 
Share this answer
 
v2
SQL
select distinct companyname from tablename
 
Share this answer
 
v2
I am Talking abt data table

i got it
Dim distinctTable As DataTable = table11.DefaultView.ToTable("DistinctTable", True, "Name")
 
Share this answer
 
v3
Comments
hitech_s 14-Oct-11 5:17am    
bold is not clear in heavy bright ness monitors so i edited that

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900