List:General Discussion« Previous MessageNext Message »
From:Victor Subervi Date:December 6 2009 6:26pm
Subject:Select Problem
View as plain text  
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

Thread
Select ProblemVictor Subervi6 Dec
  • Re: Select ProblemSteve Edberg6 Dec
Re: Select ProblemVictor Subervi7 Dec