Dennis S

Dennis S

  • NA
  • 102
  • 2k

Sort without duplicates

Dec 21 2005 8:38 PM

Hi everybody,
   I posted the original topic in other forums and solutions they provided involves using .Net Framework 2.0. i am using .Net framework 1.1. Trying to avoid using a lot of sql access (Select Distinct statement execution) and a lot of loop execution. Do anyone knows another way to solved this problem? Thanks in advanced.

Original Post:
 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
------------------------------------------


Dennis


Answers (1)