retrieve data from database with duplicate values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamesd0142
    Contributor
    • Sep 2007
    • 471

    #1

    retrieve data from database with duplicate values

    I have the follwoing code that populates a txt box by reading values from a database table.

    While Reader4.Read()
    Category4 = Reader4.Item(Co lumns4)'READ COLUMN FROM DATABASE
    txtAnswer.Text = Category4
    End While

    columns4 contains the id field within this table. there are duplicateds. so i hvae to records with the id filed '1'

    when i run the code it retrieves the first record and then over writes with with the next value in the table with the same id.

    Would any1 know how to edit this so that it only displays the first value it gets?

    Thanks
  • jamesd0142
    Contributor
    • Sep 2007
    • 471

    #2
    Ignore this it works, stupid question SORRY

    Comment

    • VBPhilly
      New Member
      • Aug 2007
      • 95

      #3
      Originally posted by jamesd0142
      Ignore this it works, stupid question SORRY
      Glad it worked.

      Duplicates query (in case anyone wants to know)

      Returns duplicate records:

      SELECT DuplicatedField
      FROM TableName
      GROUP BY DuplicatedField
      HAVING COUNT(Duplicate dField) > 1

      Comment

      Working...