|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Grouping records - HOW TOIs there a way that I can get the same sort of output as when you create a relationship between two tables, but with only one table? With a dataset containing two (or more) tables that has a data relation added, you get a resultant output (say a datagrid) that groups by the column detailed in the relationship. When the datagrid is displayed it shows each parent record (row) with a '+' next to it. When selected you can then display the related child records. I have a single table with multiple records. Let's say one field is name. There may be multiple records for each person who is displayed in the name field. Instead of doing a simple sort and showing all records at the same time, I would like to have the '+', and only show the persons name once. I could then expand that record to show all for that person. Is this possible? I am using VB.Net, windows display (not IE), and sql server. Hope there is an answer out there................even if it is NO ;-) Rgds, Phil Phil,
use SELECT DISTINCT name FROM table for the first DataTable and SELECT name, other_cols_needed FROM table for the second DataTable. Then add a DataRelation on the name column. Show quote "Phil" <Phil@nospam.com> wrote in message news:ddkugr$a1h$1@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com... > Hi, > > Is there a way that I can get the same sort of output as when you create a > relationship between two tables, but with only one table? > > With a dataset containing two (or more) tables that has a data relation > added, you get a resultant output (say a datagrid) that groups by the > column detailed in the relationship. When the datagrid is displayed it > shows each parent record (row) with a '+' next to it. When selected you > can then display the related child records. > > I have a single table with multiple records. Let's say one field is name. > There may be multiple records for each person who is displayed in the name > field. Instead of doing a simple sort and showing all records at the same > time, I would like to have the '+', and only show the persons name once. I > could then expand that record to show all for that person. > > Is this possible? > > I am using VB.Net, windows display (not IE), and sql server. > > Hope there is an answer out there................even if it is NO ;-) > > Rgds, Phil > Dejan,
Thanks for the response but I only have ONE table, as stated. If I had two tables then it wouldn't be a problem for me. Can it be done with one table? Cheers, Phil Show quote "Dejan Sarka" <dejan_please_reply_to_newsgroups.sa***@avtenta.si> wrote in message news:%23r89FNBoFHA.4028@TK2MSFTNGP10.phx.gbl... > Phil, > > use > SELECT DISTINCT name FROM table > for the first DataTable and > SELECT name, other_cols_needed FROM table > for the second DataTable. > Then add a DataRelation on the name column. > > -- > Dejan Sarka, SQL Server MVP > Associate Mentor > www.SolidQualityLearning.com > > "Phil" <Phil@nospam.com> wrote in message > news:ddkugr$a1h$1@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com... >> Hi, >> >> Is there a way that I can get the same sort of output as when you create >> a relationship between two tables, but with only one table? >> >> With a dataset containing two (or more) tables that has a data relation >> added, you get a resultant output (say a datagrid) that groups by the >> column detailed in the relationship. When the datagrid is displayed it >> shows each parent record (row) with a '+' next to it. When selected you >> can then display the related child records. >> >> I have a single table with multiple records. Let's say one field is name. >> There may be multiple records for each person who is displayed in the >> name field. Instead of doing a simple sort and showing all records at the >> same time, I would like to have the '+', and only show the persons name >> once. I could then expand that record to show all for that person. >> >> Is this possible? >> >> I am using VB.Net, windows display (not IE), and sql server. >> >> Hope there is an answer out there................even if it is NO ;-) >> >> Rgds, Phil >> > > |
|||||||||||||||||||||||