-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 15 February 2004 10:56, Mr. Justin G. Kozuch wrote:
> Hi All,
>
> I need with an SQL statement.
>
> 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?
>
> Does this make sense?

Could have been a bit more descriptive, but I think this is what you asked. 
You have two tables:

portfolio
- ----------
categories      int
value           int

categories
- -------------
categoryvalue   int
categorydescription             char(???)

*IF* I understand the description, column "categories" in portfolio should 
match a "categoryvalue" in categories. The query you describe doesn't seem to 
need anything from the portfolio table, though. If all you need is a listing 
from the categories table, then just ask for that column directly. e.g.

        Select categoryvalue, categorydescription from categories;

BUT, I'm guessing that you want something from the portfolios table as well. 
If so:

        Select p.value, c.categorydescription from portfolio p JOIN categories c
                ON p.categories = c.categoryvalue;

Change the requested column names as needed, of course.

- ---Michael

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQFAL6tnjeziQOokQnARAoc4AJ9UOo+fhKhiUJkWeZOtHoZ7ice7KgCfdNua
k8N7xt/j0FlGAUrwfsDGlc8=
=KxiT
-----END PGP SIGNATURE-----


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to