Results 1 to 1 of 1
  1. #1
    Join Date
    Apr 2003
    Location
    paris, FRANCE
    Posts
    88

    Question Unanswered: comparing fields

    Hello,
    I already asked a similar question on : http://dbforums.com/showthread.php?threadid=818633
    but this time I have tidied my databases!!

    I have two databases which have multiple entries containg each multiple fields, and each of these fields contains a single keyword.

    Paste this html code on a txt file, to really see how the tables look, I cant preview them correctly on the forum...
    Table 1 (m rows, n keywords for each row)
    HTML Code:
    <table> 
    <tr> 
    <td>number</td> 
    <td>keyword[1]</td> 
    <td>keyword[2]</td> 
    <td>keyword[i]</td> 
    <td>keyword[n]</td> 
    </tr> 
    <tr> 
    <td>1</td> 
    <td>cat</td> 
    <td>dog</td> 
    <td>horse</td> 
    <td>sheep</td> 
    </tr> 
    <tr> 
    <td>j</td> 
    <td>......</td> 
    <td>.......</td> 
    <td>......</td> 
    <td>........</td> 
    </tr> 
    <tr> 
    <td>m</td> 
    <td>volvo</td> 
    <td>bmw</td> 
    <td>ferrari</td> 
    <td>renault</td> 
    </tr> 
    </table> 
    Table 2 (p rows, n keywords for each row)
    HTML Code:
    <table> 
    <tr> 
    <td>number</td> 
    <td>keyword[1]</td> 
    <td>keyword[2]</td> 
    <td>keyword[i]</td> 
    <td>keyword[n]</td> 
    </tr> 
    <tr> 
    <td>1</td> 
    <td>spider</td> 
    <td>dog</td> 
    <td>snake</td> 
    <td>fish</td> 
    </tr> 
    <tr> 
    <td>k</td> 
    <td>......</td> 
    <td>.......</td> 
    <td>......</td> 
    <td>........</td> 
    </tr> 
    <tr> 
    <td>p</td> 
    <td>audi</td> 
    <td>ford</td> 
    <td>ferrari</td> 
    <td>chrysler</td> 
    </tr> 
    </table> 
    I want access (or maybe excel would be easier), to take each word from one table and to search through the other table for matching. You 'll have understood it, in this example I'd like a third database created with the matches dog and ferrari, as following:

    Table 3
    HTML Code:
    <table> 
    <tr> 
    <td>match number </td> 
    <td>Keyword match</td> 
    <td>entry table 1</td> 
    <td>entry table 2 </td> 
    </tr> 
    <tr> 
    <td>1</td> 
    <td>dog</td> 
    <td>1</td> 
    <td>1</td> 
    </tr> 
    <tr> 
    <td>k</td> 
    <td>......</td> 
    <td>.......</td> 
    <td>......</td> 
    <td>........</td> 
    </tr> 
    <tr> 
    <td>2</td> 
    <td>ferrari</td> 
    <td>2</td> 
    <td>2</td> 
    </tr> 
    </table> 
    What's the command line, or the function? I believe there will be four loops embeddedlike this:
    for i=1 to i=m (table1)
    {
    for j=1 to j=n (table1)
    { read keyword[j]

    for k=1 to k=p (table2)
    {
    for l=1 to l=n (table2)
    {search keyword[j]
    }
    End for
    If keyword [k] [l]=keyword[j]
    Return [k] [l] [j]
    Else
    }
    End for
    }
    End for
    }
    End for



    But I don't know the functions nor the declarations to write...

    Thanks for your help.
    I have two databases which have multiple entries containg each multiple fields, and each of these fields contains a single keyword.

    Table 1 (m rows, n keywords for each row)
    HTML Code:
    <table>
    <tr>
        <td>number</td>
        <td>keyword[1]</td>
        <td>keyword[2]</td>
        <td>keyword[i]</td>
        <td>keyword[n]</td>
      </tr>
      <tr>
        <td>1</td>
        <td>cat</td>
        <td>dog</td>
        <td>horse</td>
        <td>sheep</td>
      </tr>
      <tr>
        <td>j</td>
        <td>......</td>
        <td>.......</td>
        <td>......</td>
        <td>........</td>
      </tr>
      <tr>
        <td>m</td>
        <td>volvo</td>
        <td>bmw</td>
        <td>ferrari</td>
        <td>renault</td>
      </tr>
    </table>
    Table 2 (p rows, n keywords for each row)
    HTML Code:
    <table>
    <tr>
        <td>number</td>
        <td>keyword[1]</td>
        <td>keyword[2]</td>
        <td>keyword[i]</td>
        <td>keyword[n]</td>
      </tr>
      <tr>
        <td>1</td>
        <td>spider</td>
        <td>dog</td>
        <td>snake</td>
        <td>fish</td>
      </tr>
      <tr>
        <td>k</td>
        <td>......</td>
        <td>.......</td>
        <td>......</td>
        <td>........</td>
      </tr>
      <tr>
        <td>p</td>
        <td>audi</td>
        <td>ford</td>
        <td>ferrari</td>
        <td>chrysler</td>
      </tr>
    </table>
    I want access (or maybe excel would be easier), to take each word from one table and to search through the other table for matching. You 'll have understood it, in this example I'd like a third database created with the matches dog and ferrari, as following:

    Table 3
    HTML Code:
    <table>
    <tr>
        <td>match number </td>
        <td>Keyword match</td>
        <td>entry table 1</td>
        <td>entry table 2 </td>
      </tr>
      <tr>
        <td>1</td>
        <td>dog</td>
        <td>1</td>
        <td>1</td>
      </tr>
      <tr>
        <td>k</td>
        <td>......</td>
        <td>.......</td>
        <td>......</td>
        <td>........</td>
      </tr>
      <tr>
        <td>2</td>
        <td>ferrari</td>
        <td>2</td>
        <td>2</td>
      </tr>
    </table>
    What's the command line, or the function? I believe there will be four loops embedded like this:
    for i=1 to i=m (table1)
    {
    for j=1 to j=n (table1)
    { read keyword[j]

    for k=1 to k=p (table2)
    {
    for l=1 to l=n (table2)
    {search keyword[j]
    }
    End for
    If keyword [k] [l]=keyword[j]
    Return [k] [l] [j]
    Else
    }
    End for
    }
    End for
    }
    End for

    But I don't know the functions nor the declarations to write...

    Thanks for your help.
    Last edited by nicolascaprais; 06-25-03 at 11:06.

Posting Permissions

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