473,788 Members | 2,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 14293
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.o rg> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
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.o rg> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
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
347
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 application is running fine. On a machine with Hyperthreading CPU, after a couple of seconds of running OK, the
0
1216
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 with it and then project 2 and all the items that go with it. I have a start but am unsure of where to go. I am attaching the files that I have. Any help would be appreciated. Thanks, Dave
0
1224
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 to convert the ListDictionary to a kind of System.Data.DataSet. Thanks in advance! Gabriel
3
1958
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
4424
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 Repeater-Control. This Repeater-Control accepts anything like System.Collections.IEnumerable for a DataSource. I have tried to copy the System.Data.Dataset into a DataView-Objekt (System.Collections.IEnumerable) but I guess there must be some other and
1
9362
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 know why I cannot perform this casting operation properly. First off, I've got my Typed DataSet named "AuthInfo" declared and I then created an instance of that class. What I'd like to do next is to perform querying through the method...
6
9084
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 btnLookup_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLookup.Load If Not Page.IsPostBack Then Dim queryString As String = "Select CompanyID As CompanyID, Company As Company, As , As , Phone As Phone, + ' ' +...
3
1689
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 database always. Unfortunately this is a big dataset... so once the dataset stored into session, the browsing system gets slow(bcoz its taking more memory)... So can anyone suggest a way to store user related data (dataset) other than session.......
5
5086
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 dbo_Roster to access 2000, I try to group data by Service and dates, for example 01/01 to 01/31 is Jan08, 01/02 to 28/2 is Feb08 and so on. The result should be like below : Service Jan08 Feb08 Mar08 Apr08 May08 Jun08 ...
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.