Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2013
    Posts
    1

    Unanswered: Three-way join missing values from third table

    have a three way join that grabs the correct amount of rows but returns blank values. The table names and column names are correct. On the last join, s.int does indeed match SOD.orderID. I tested it with just the first join and it worked. The [!prefix] is a platform requirement and not affecting the results. It is possible to join two tables to one table?

    'SELECT S.name, S.price, SD.store_value AS type, SOD.quantity
    FROM [!prefix]store as S
    JOIN [!prefix]storedetail as SD
    ON S.`int` = SD.storeID
    LEFT JOIN [!prefix]store_orders_details as SOD
    ON S.`int` = SOD.orderID
    WHERE S.`int` = ?';

    ^This is the query I am using. This gave me All the appropriate column titles and values except for SOD.quantity. SOD.quanitity is blank. I double-checked the table and there are values there. I would think that if it had the right column, it would grab the value in the column?

  2. #2
    Join Date
    Oct 2006
    Location
    CA
    Posts
    210
    Its strange that S.`int` works for linking to both SD.storeID and SOD.orderID.

    I'm going to guess tthat you meant for the final join statement to be:

    Code:
    LEFT JOIN store_order-details as SOD
    ON SD.orderID = SOD.orderID.
    If that's not the solution, then can you submit the Create Table statements?

Tags for this Thread

Posting Permissions

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