Results 1 to 2 of 2

Thread: Query problem

  1. #1
    Join Date
    Jan 2002
    Location
    Nottingham - UK
    Posts
    113

    Cool Unanswered: Query problem

    I have 2 tables. One table has 2 text fields i.e Customer name and 2nd customer name. The other table has a text field i.e customer dealt with name.

    I need to create a query whereby I can enter a input box asking the user to input the search request this will then search 3 fields across 2 tables.

    Can anyone help.

  2. #2
    Join Date
    Nov 2001
    Posts
    336
    Here is the query:

    PARAMETERS [j] Text ( 255 );
    SELECT Table1.name1
    FROM Table1
    WHERE (((Table1.name1) Like [j] & "*"))

    Union SELECT Table1.name2
    FROM Table1
    WHERE (((Table1.name2) Like [j] & "*"))

    UNION SELECT Table2.name3
    FROM Table2
    WHERE (((Table2.name3) Like [j] & "*"));

    Note:
    This query will remove all duplicate names. If you to keep duplicate names, then add keyword "All" after Union:

    PARAMETERS [j] Text ( 255 );
    SELECT Table1.name1
    FROM Table1
    WHERE (((Table1.name1) Like [j] & "*"))

    Union All SELECT Table1.name2
    FROM Table1
    WHERE (((Table1.name2) Like [j] & "*"))

    UNION All SELECT Table2.name3
    FROM Table2
    WHERE (((Table2.name3) Like [j] & "*"));

    Igor

Posting Permissions

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