* Mr. Justin G. Kozuch
> I have two tables in my database (mySQL): portfolio and categories.
>
> In the portfolio table, I have a column called categories, and
> there is a number value int here depending on where the item is
> placed in my portfolio. So value 1 is web design, value 2 is
> flash, etc etc etc.
>
> In the categories table, I have a column called categoryvalue and
> categorydescription. Categoryvalue has a number value and
> categorydescription has, well, a description of that category.
>
> On my detail page, can I setup the SQL statement to show the
> description of the category and not the numerical value of the category?
I think you need a JOIN:
SELECT portfolio.*,categories.categorydescription
FROM portfolio,categories
WHERE
portfolio.categories = categories.categoryvalue AND
portfolio.id = $portfolioID
This works if all portfolios have (at least) one related category. If some
don't, you will need a LEFT JOIN. "categories.categoryvalue" should be a
primary key.
<URL: http://www.mysql.com/doc/en/JOIN.html >
--
Roger
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]