List:General Discussion« Previous MessageNext Message »
From:Mark Goodge Date:December 14 2009 4:51pm
Subject:Re: Join Statement
View as plain text  
Victor Subervi wrote:
> On Mon, Dec 14, 2009 a
> 
> mysql> select SKU, Quantity, Name, Price, t.sizes,
> t.colorsShadesNumbersShort from tem126080739853 t join products p on
> t.ProdID-p.ID <http://t.prodid-p.id/>;
> Empty set (0.00 sec)
> 
> mysql> select ID, SKU, Name, Price from products;
> +----+----------+-------+--------+
> | ID | SKU      | Name  | Price  |
> +----+----------+-------+--------+
> |  2 | prodSKU1 | name1 | 555.22 |
> +----+----------+-------+--------+
> 1 row in set (0.00 sec)
> 
> t.ProdID == 2
> p.ID == 2
> That's a match.
> So why does my select join fail?

Because you're using a minus sign where you should be using an equals 
sign. This is what you're doing:

select
SKU, Quantity, Name, Price, t.sizes,t.colorsShadesNumbersShort
from tem126080739853 t
join products p on
t.ProdID-p.ID

This is what you should be doing:

select
SKU, Quantity, Name, Price, t.sizes,t.colorsShadesNumbersShort
from tem126080739853 t
join products p on
t.ProdID=p.ID

Mark
Thread
Join StatementVictor Subervi14 Dec
  • Re: Join StatementPeter Brawley14 Dec
    • Re: Join StatementVictor Subervi14 Dec
      • Re: Join StatementShawn Green14 Dec
      • Re: Join StatementMark Goodge14 Dec
      • Re: Join StatementPeter Brawley14 Dec
        • Re: Join StatementVictor Subervi14 Dec
  • RE: Join StatementSteven Staples14 Dec