At 1:26 PM -0500 12/6/09, Victor Subervi wrote:
Hi;
I have the following:
mysql> select * from categoriesProducts as c inner join relationshipProducts
as r on c.ID = r.Child inner join categoriesProducts as p on r.Parent = p.ID
where p.Category = prodCat2;
ERROR 1054 (42S22): Unknown column 'prodCat2' in 'where clause'
mysql> describe categoriesProducts;
+----------+-----------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-----------------+------+-----+---------+----------------+
| ID | int(3) unsigned | NO | PRI | NULL | auto_increment |
| Category | varchar(40) | YES | | NULL | |
| Parent | varchar(40) | YES | | NULL | |
+----------+-----------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)
mysql> select * from categoriesProducts;
+----+----------+--------+
| ID | Category | Parent |
+----+----------+--------+
| 1 | prodCat1 | None |
| 2 | prodCat2 | None |
+----+----------+--------+
2 rows in set (0.00 sec)
So I'm at a loss. No, 'prodCat2' isn't a column, but I don't understand how
I specified that in my query. Please advise.
TIA,
Victor
You didn't quote prodCat2 in the query, so it was assuming you were
referring to the column name. Try:
select * from categoriesProducts as c inner join relationshipProducts
as r on c.ID = r.Child inner join categoriesProducts as p on r.Parent = p.ID
where p.Category = 'prodCat2';
- s
--
+------------------------------------------------------------------------+
| Steve Edberg edb...@edberg-online.com |
| Programming/Database/SysAdmin http://www.edberg-online.com/ |
+------------------------------------------------------------------------+
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org