possibly using GROUP BY. As always Books Online would be the first place to
"den 2005" wrote:
> Thanks for replies, Uri and John
>
> Simply I like to find out if there is a sql statement to be able to do this
> in sql and not in application, but basically I like to sort the data and
> isplay them ass hown without duplicates and joins simply not quite
> applicable, it would be complicated and might not return what I like, Is join
> applicable on same table, the data I like to sort comes from same table.
>
> den2005
> --
> MCP Year 2005, Philippines
>
>
> "John Bell" wrote:
>
> > Hi
> >
> > Check out
http://www.aspfaq.com/etiquette.asp?id=5006 on how to post usable
> > DDL and example data also posting the expected results from the example data
> > would be useful. How your content relates to the topic is not clear, if
> > there is a relationship then you will (probably) need to join the two tables
> > on the related columns see the topic "Using Joins" in Books online.
> >
> > Assigning your data values to a label would require client code.
> >
> > John
> >
> >
> > "den 2005" <den2005@discussions.microsoft.com> wrote in message
> > news:3D062C93-0DA7-4631-BEAE-C947A5A93F38@microsoft.com...
> > > 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
> > > --
> > > MCP Year 2005, Philippines
> >
> >