SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Search multiple tables query

    Hi

    I have an access database that i would like to search. Its for a search engine where the user will type in a search term and the program (in asp) will query the database.

    I am struggling to construct the query as not all of the tables are related.

    The tables are constructed as follows:

    Product Pictures
    ProductCode
    HiResPath

    Products
    Productcode
    Datasheetfilename

    News
    newsStory

    Promo
    promoStory

    subcategories
    subcategoryName

    Is there a way to write a query that can search these required tables and fields?

    Any help would be most appreciated.

  2. #2
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,249
    Mentioned
    113 Post(s)
    Tagged
    1 Thread(s)
    You can use UNION ALL

    (note: this is a bad example since these would probably be joined instead, but you get the idea)

    SELECT ProductCode FROM Product_Pictures WHERE ProductCode LIKE '*A*'
    UNION ALL
    SELECT ProductCode FROM Products WHERE ProductCode LIKE '*A*'
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style


Bookmarks

Posting Permissions

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