Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005

    Unanswered: Search form returning duplicate records

    My database consists of a main table that has 2 one-to-many relationships with 2 tables and 2 many-to-many relationships with 2 other tables. I have coded a simple search form that allows users to select any of the values of any of 4 fields which reference values in the linked tables. If a user searches on one of the one-to-many fields, duplicate records in the main table are returned. to pull up any one record where the value for something in one of the one-to-many fields matches a certain criteria, there may be many related entries in the many-to-many tables, so the record in the main table shows up in the results of the search query as many times as there are individual relationships with records in the many-to-many tables. how can i get the search form to display one and only one instance of each record in the main table?

    if this is incoherent or difficult to understand let me know and i'll try to rephrase it. i just wanted to avoid a really super-long post.


  2. #2
    Join Date
    Dec 2002
    Préverenges, Switzerland
    without knowledge of the SQL used by your search form i can only offer a generic answer...
    at some stage in your query hierachy you have
    SELECT blah blah blah
    find the crucial stage and switch to
    SELECT DISTINCT blah blah blah

    Last edited by izyrider; 12-29-05 at 15:05. Reason: missing "by"
    currently using SS 2008R2

  3. #3
    Join Date
    Dec 2005
    that did it. thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts