Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2006
    Posts
    8

    Unanswered: JOIN based on column value

    Hi,

    May be a stupid question, but is it possible to JOIN a certain record based on a column value?

    TABLE: PRODUCTS(ID,PRODUCT_ID,PRODUCT_TYPE)
    PRODUCTS(1,1,1)
    PRODUCTS(1,1,2)
    PRODUCTS(1,1,3)

    TABLE: PRODUCT_DETAILS_1(1,"aaa")
    TABLE: PRODUCT_DETAILS_2(1,"bbb")
    TABLE: PRODUCT_DETAILS_3(1,"ccc")

    I want to create a query that joins all records in TABLE PRODUCTS to the respective PRODUCT_DETAILS_x TABLE:

    If(PRODUCTS.PRODUCT_TYPE = 1)
    LEFT JOIN PRODUCT_DETAILS_1 ...
    If(PRODUCTS.PRODUCT_TYPE = 2)
    LEFT JOIN PRODUCT_DETAILS_2 ...
    If(PRODUCTS.PRODUCT_TYPE = 3)
    LEFT JOIN PRODUCT_DETAILS_3 ...

    etc.

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool


    Maybe this or this can help.

    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

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