Victor,

> I beg to differ:
> mysql> select SKU, Quantity, Name, Price, p.sizes,
> p.colorsShadesNumbersShort from tem126080739853 t join products p on
> t.ProdID-p.ID <http://t.prodid-p.id/>;

...on t.ProdID-p.ID... _subtracts_ the two IDs. To match them use '=' rather than '-'.

PB

-----

Victor Subervi wrote:
On Mon, Dec 14, 2009 at 12:37 PM, Peter Brawley <peter.braw...@earthlink.net
wrote:

 > ... on t.ProdID-p.ID;

Your join clause subtracts the two IDs, so it's on IDs that differ, and
apparently there aren't any.


I beg to differ:

mysql> select SKU, Quantity, Name, Price, p.sizes,
p.colorsShadesNumbersShort from tem126080739853 t join products p on
t.ProdID-p.ID <http://t.prodid-p.id/>;
Empty set (0.00 sec)

mysql> select * from tem126080739853;
+----+--------+----------+----
---------+--------------------------+
| ID | ProdID | Quantity | sizes       | colorsShadesNumbersShort |
+----+--------+----------+-------------+--------------------------+
|  1 |      2 |        2 | Extra-small | navy-blue:CC7722         |
+----+--------+----------+-------------+--------------------------+
1 row in set (0.00 sec)
mysql> select SKU, Quantity, Name, Price, p.sizes,
p.colorsShadesNumbersShort from tem126080739853 t join products p on
t.ProdID-p.ID <http://t.prodid-p.id/>;
Empty set (0.03 sec)

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?
TIA,
V

------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.427 / Virus Database: 270.14.107/2564 - Release Date: 12/14/09 07:37:00

Reply via email to