Interesting DataSet/DataTable question

  • Thread starter Sahil Malik [MVP]
  • Start date
S

Sahil Malik [MVP]

Friend of mine asked me this, I'll try look at this later in the evening,
but hey feel free to take a stab --

lets say I have a table(table1) that looks like

Region,State,count
--------------------
West,CA,10
West,AZ,20
East,NY,30
East,NJ,40

Using SQL query
-------------------
select region,sum(count)
from table1
group by region

output will be ..
----------------
West,30
East,70

Instead of using abpve query, Assuming "Select * from table1" is fed into a
dataset/datatable, I want to see a recordset view like this ...
West,30
East,70


Is there a direct way of doing it ?(this can be done if i manually remove
state column from column collection and then add up counts for Region column
and dynamically generate a recordet like this .. but i was wondering if
there is a direct way of doing it ??)

- Sahil Malik [MVP]
http://codebetter.com/blogs/sahil.malik/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top