Querying a scalar in DataTable

  • Thread starter Thread starter Curious
  • Start date Start date
C

Curious

Hi,

I have a DataTable with three columns (2 int, and 1 string). Now I
would like a query that return the total number of different integers
in one of the interger columns.

For example
Name Age Class
A 12 4
B 13 5
C 11 3
D 12 3

Now if I select the total number of different integers in the Age
column the answer is 3(because 11, 12 ,13).


I hope someone understands my problem.
Can some one help me out
Thanks in Advance
 
I have the data also available in an xml file. Is there a way to do it
using XPath or some other technology?
 
Just a slight clarification - op was asking for a distinct functionality so
I doubt that your sample correct for this issue.
 
Miha,
Just a slight clarification - op was asking for a distinct functionality
so I doubt that your sample correct for this issue.
In my idea he was asking for a scalar situation, what this code in fact
does.

(That is what is written in the subject in my opinion)

Cor
 
Curious,
I have the data also available in an xml file. Is there a way to do it
using XPath or some other technology?

That is not one of my favorite kinds of sport, maybe somebody else know
that.

Cor
 
Yes, but that scalar counts distinct rows.Just a general sample. That selection is easy to remove. It goes about how
to use the compute in this kind of situations, and because that in the
select is forever the datetime literal is difficult to do have I added that

Two samples for the price of one.

:-)

Cor
 
Back
Top