Distinct records dataset display

Discussion in 'C#' started by garp2100, Jan 22, 2008.

  1. #1
    Hello Everyone, back again with some more questions for the group!

    I'm developing a database driven application in which I show a group of people. I have a database of people in which some individuals have more than one instance of address or location. On my database this is shown as a duplicate record. (example below)

    [​IMG]

    Whenever I try to display the record in an ASP dataset within my page I get duplicate instances of the same record (which I know is logical taking into account the way it's laid out on the database). My question is: are there any ways around it? is there a way in which I can display just one name and then two instances of all their biographical info?

    Thank you!
     
    garp2100, Jan 22, 2008 IP
  2. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You would be best to alter your SQL query first to either dedupe the records/ order them so they are together etc depending on what your exact requirement is.

    After that you may need to change your ASP script for generating the HTML output depending on how you want it to display.
     
    AstarothSolutions, Jan 23, 2008 IP
  3. teraeon

    teraeon Peon

    Messages:
    40
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    For what you're looking for you can do an ORDER BY Name. Then in your code while looping through (if you're using classic ASP) you will do the following:

    dim strPrevName

    do while not RecordSet.EOF
    if strPrevName <> RecordSet("Name") Then
    strPrevName = RecordSet("Name")
    {DISPLAY NAME CODE}
    end if
    {DISPLAY RECORD CODE}
    Recordset.MoveNext:Loop
     
    teraeon, Jan 28, 2008 IP