473,324 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Is it possible to group data in a dataset?

Hi All and thanks in advance,

I was wondering what is the best way of grouping data in a dataset. Like
using a "Group By" clause in Sql statements. I was thinking of using XML
but I don't even know how to do grouping in XML.

I have a dataset table which i would like to supposedly run the following
sql statement on:

Select UserID from tblAccounts
Group By UserID

Any ideas would be highly appreciated,

Thanks again,

Amadelle

Nov 16 '05 #1
5 14262
In article <em**************@TK2MSFTNGP09.phx.gbl>, am******@yahoo.com
says...
Hi All and thanks in advance,

I was wondering what is the best way of grouping data in a dataset. Like
using a "Group By" clause in Sql statements. I was thinking of using XML
but I don't even know how to do grouping in XML.

I have a dataset table which i would like to supposedly run the following
sql statement on:

Select UserID from tblAccounts
Group By UserID


You're not using any aggregating function (like MIN, MAX, AVG, etc...)
so why do you need the GROUP BY?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 16 '05 #2
r u seriously asking me that question?

I don't have to have aggregate functions to use a Group by Clause.

tblAccounts
accountID userID
1 23
2 23
3 23
4 35
5 35

the group by clause that I have will return the following:

UserID
23
35

basically a user can have zero to many accounts I just want all the users in
the tblAccounts that do have accounts associated with them but i don't want
their account details.

Hope this helps you help me find a solution,

Thanks

"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <em**************@TK2MSFTNGP09.phx.gbl>, am******@yahoo.com
says...
Hi All and thanks in advance,

I was wondering what is the best way of grouping data in a dataset. Like using a "Group By" clause in Sql statements. I was thinking of using XML but I don't even know how to do grouping in XML.

I have a dataset table which i would like to supposedly run the following sql statement on:

Select UserID from tblAccounts
Group By UserID


You're not using any aggregating function (like MIN, MAX, AVG, etc...)
so why do you need the GROUP BY?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 16 '05 #3
In article <#V**************@tk2msftngp13.phx.gbl>, am******@yahoo.com
says...
r u seriously asking me that question?
Yes, I am.
I don't have to have aggregate functions to use a Group by Clause.
True. But you don't need group by to do what you want.
tblAccounts
accountID userID
1 23
2 23
3 23
4 35
5 35

the group by clause that I have will return the following:

UserID
23
35


Look into SELECT DISTINCT.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 16 '05 #4
"Distinct" statment still doens't change the fact that you don't need an
aggregate function to do "Group By".
And even with a Distinct statement my issue is still outstanding on how to
do Grouping on a dataset? In my original email I explained that I want a
"similar" functionality as what a "Group By" statement provides me with in
SQL. If there is a way to use Distinct statement on a dataset or XML, or a
dataview, I would still be happy.

So if you have a solution please let me know ...

Thanks,

Amadelle
"Patrick Steele [MVP]" <pa*****@mvps.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <#V**************@tk2msftngp13.phx.gbl>, am******@yahoo.com
says...
r u seriously asking me that question?


Yes, I am.
I don't have to have aggregate functions to use a Group by Clause.


True. But you don't need group by to do what you want.
tblAccounts
accountID userID
1 23
2 23
3 23
4 35
5 35

the group by clause that I have will return the following:

UserID
23
35


Look into SELECT DISTINCT.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 16 '05 #5
In article <uh**************@TK2MSFTNGP09.phx.gbl>, am******@yahoo.com
says...
"Distinct" statment still doens't change the fact that you don't need an
aggregate function to do "Group By".
I never said it was needed. I asked why you felt you needed a GROUP BY
-- DISTINCT is a better description of what you want.
And even with a Distinct statement my issue is still outstanding on how to
do Grouping on a dataset? In my original email I explained that I want a
"similar" functionality as what a "Group By" statement provides me with in
SQL. If there is a way to use Distinct statement on a dataset or XML, or a
dataview, I would still be happy.


The reason I mentioned SELECT DISTINCT was because it would be easier to
let the database do their sorting/aggregating/filtering for you instead
of doing it on the client.

But anyway.... No, you can't do what you'd like with a DataSet or
DataView. Might be able to do it with XML, but I abhor XSL so don't
know how to do it.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: octaviansen | last post by:
Hi, I am experiencing some weird problems with an ASP.NET web application that is making use of System.Data.DataSet and System.Data.DataRow classes. On a machine with single CPU, the...
0
by: David Elliott | last post by:
I am trying to group data. I have a daily record that contains multiple projects and multiple items in the project. I would like to roll the daily data into project 1 and all the items that go...
0
by: Gabriel Cirera | last post by:
Hello, Is it possible to fill a DataGrid with a ListDictionary? I tried to find the solution in this groups but I couldn't... Maybe is not possible.. who knows. I suppose it has to be some way...
3
by: Oney | last post by:
Sql Reporting Services uses sql command and stored procedures to prepare report. but I need to use dataset to manipulate data in a class. So is it possible with Sql Reporting Services ? Thanks
1
by: Greg Cyrus | last post by:
Hi, i have created a function to open a Databse by OLEDB and fill it into a System.Data.DataSet-Objekt by oleDBAdapter.Fill-Mehtod.. Now I want to assign this DataSet to a normal...
1
by: Optimus | last post by:
Hi everyone, I currently develop an application in vs.net 2005 with vb.net. I was trying to use typed dataset and I've got in trouble for converting untyped dataset into Typed DataSet. I don't...
6
by: marylipscomb | last post by:
I am using VB.NET. I am trying to connect a button so that when it is clicked the gridview pops up the data. Partial Class Switchboard Inherits System.Web.UI.Page Protected Sub...
3
prabunewindia
by: prabunewindia | last post by:
Hi, for my project, i am using session to store the user's information like userid, username... Also i am storing the dataset, which is having the datas for the particular user to avoid trip to...
5
by: HowHow | last post by:
First time using crosstab query because tired of creating queries and put them together in one query (such a stupid thing to do :D). Not sure how it works still. I have link table called...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.