Hi, > The error I get while trying executing is "Unknown column > 'products.product_id' in 'on clause'. Since I am selecting all > columns from that table (products), I can't really see why there's a > fuss about it!
# SELECT products.*, manufactors.*, # IF(( # SELECT i.supplier_id FROM products.items_new i # JOIN products.item_status ON (item_status.product_id = products.product_id && item_status.supplier_id = i.supplier_id && item_status.group_id = 1) # WHERE i.product_id = products.product_id && i.item_stock > 0 # ), # ... Well, `JOIN` has nothing to do with the columns you are selecting - it rather looks in the tables you are selecting `FROM`. In your case, you are selecting `FROM products.items_new i` and joining it to `products.item_status`. These are the only two tables you can use in the JOIN. You can not use a table from another SELECT (which you are doing here). This kind of reference is supported in the WHERE clause only. Best regards, Aleksandar -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]