DataSet problems - selecting on aggregate functions

R

R Avery

I have a dataset containing an already-populated single datatable which
I which to perform an operation on. The structure of the table is
below: Specifically, I want to get the most recent message for every
unique {Group, User, Subject} subject to TimeStamp being less than an
AsOfDate that is externally specified. I then want to bind this table
to a DataGrid. I am having trouble since I am used to Access queries
(new to the .NET arena), and do not know where to start.


TableName: Messages

Fields:
Group (String)
User (String)
Subject (String)
Message (String)
TimeStamp (DateTime)

Primary Key: {Group, User, Subject, TimeStamp}


Any help would be most appreciated. Thanks!
 
W

William Ryan eMVP

DataTable.Compute(SUM(GROUP), "Group <> ''")
Use the compute function, yuo can specify a condition in the group so if you
want all the stuff for group summmed by user, loop through users and get
each unique value. Then call the Compute Function and bulid the filter so
User = LoopValue

You can nest your loops and filters and you'll be good to go.

Let me know if you have any problems.

Bill
 

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

Top