Hi everybody,
I like to asked anyone who is very good at sql to help me display this data in a table
format that duplicate headings, subheadings or other columns won't appear twice or more. Can anyone help me I need to sort them and load them in a Datatable. Loop thorugh all records and display them in a label control created at run time. Thanks in advance.
Sample Data:
Topics Table
TopicId TopicLevel Topic ParentId
1 1 First 0
2 1 AnotherFirst 0
3 2 Second 1
4 2 AnotherSecond 2
5 3 Third 3
Contents Table
ContentID Heading SubHeading SubSubHeading1 NumberText Names Content1 ParentId
1 How are you Hello Someone 1 Ben some text 5
2 How are you Hello Someone 1 John other text 5
3 How are you Hello Anybody 2 Ben some text 5
4 How are you Hello Anybody 2 Mike other text 5
5 How are you Greet Anywhere 1 Ben some text 5
6 How are you Greet Anywhere 1 Luke some text 5
7 I miss you. Really When null null some text 5
8 I miss you. Really When null null some text 5
Display Format:
How are you
----------------------------------------------
Hello
-----------------------------------------------
1 Someone
----------------------------------------------
Ben some text
---------------------------------------------
John other text
---------------------------------------------
2 Anybody
---------------------------------------------
Ben some text
---------------------------------------------
Mike other text
--------------------------------------------
Greet
-------------------------------------------------
1 Anywhere
-----------------------------------
Ben some text
-------------------------------------
Luke some text
================================================
I miss you
--------------------------------------------------
Really
------------------------------------------------
When
-----------------------------------------------
some text
----------------------------------------
some text
------------------------------------------
den2005

How to sort that does not include duplicates in display?
Michael Drüing
Thanks for replying, Blair.
Yes, you can say I used force to just to get the format require to diplsya the data without duplicates from the table structure I have.
dennis
_wim
OscarMarquez
Bengab
Thanks for reply, Umachandar.
You are saying there is no possible way to sort this data at sql side before loading it to a data object like dataset or datatable I am using Reporting services or Crystal report to display this data. I will used this data to display them in a label controls, position them at runtime, meaning label controls are created at runtime.
den2005
indiana_c
Hi Umachandar,
I don't think that will work using Order by alone. Duplicates will still be shown. Thanks for reply.
den2005
Tom Forsyth
See: 'Eliminating Duplicates with DISTINCT' in BOL.
Rollin
TGunthorpe
Flatscher Markus
Hi Rollin,
I know that but I will using a lot of that, I am looking for a shorter way to do this. You are saying to use like this.
1: Select Distinct Heading From Topics
Then the result from first would be a fiter for next sql statement:
2: Select Distinct SHeading From Topics Where Heading=@heading << supply data
Then the result from second would be a fiter for next sql statement:
3: Select Distinct SSHeading From Topics Where SHeading=@sheading << supply data
Then so on and so forth.
Alll this in a loop and calling and excuting the sql repeatedly. I like to avoid that.
den2005
mesanjeeb
Thanks for reply Blair. Right now, the report option is not considered, basically I want to display the contents(data) of particular table in a labels for each data inside a panel at runtime, the problem is duplicate data is being displayed as well. I want to filter them. I konw using Crystal Report would be easier than building this display at run time.
den2005
franjorge
den. . . its an issue of reporting not programming. . .
here . . . get this access database:
http://www.obj-tec.com/MSDNForums/reportsforden2005/db1.zip
your data is in table foo. . . there is a report called report1.
look at the report design. note the grouping headers.
any reporting tool should be able to do this for you.
Jon77
Iddie
Hi Allen
Thanks for reply, It sounds a lot of work, does not know how to exactly do that, seems complex. Hierarchal typed dataset, what is that like multi-dimensional Please clarify.
den2005
Sashidhar Kokku
typed dataset is a .Net construct. ask in the .Net data access forum
basementjack
Hi Blair,
I used the long approach of using a lot select Distinct queries and use a lot of loop to get next dsitinct column and so on and so forth. It seems there is short approach to this issue right now in .Net.
den2005