Date: 06/28/02
- Next message: Terry Romine: "[PHP-DB] finding an empty association"
- Previous message: Hugh Bothwell: "[PHP-DB] Re: check two tables at same time?"
- Next in thread: andy: "[PHP-DB] Re: MySQL query from multiple tables"
- Reply: andy: "[PHP-DB] Re: MySQL query from multiple tables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi All,
I have a strange query which I need to build - I have looked at the JOIN and
aliasing functions of mySQL but not sure if I can achieve want I want to do.
I have two tables (product_head, and product_features) (in addition to a
number of other tables) which form the list of products I have available,
and the features available with each product.
I want to be able to retrieve from product_head the rows which are for a
specific product category (ie: 1).. this bit is easy.
SELECT * from product_head where prod_cat_ID = 1;
This query could return 1 or more rows - works great.
but I also want to retrieve records from the product_features table.
information stored in this table is:
prod_ID feat_ID feat_value
so for each product ID, there could be any number of features. I need to
retrieve only certain feat_value records, for specific products, where the
feat_ID equals certain values .
can I build a single query that will return all these results similar to
below?
Prod_ID Prod_name Feat_1_value Feat_2_value feat_3_value
1 prod1 34 25 15
2 prod2 10 15 15
...
does this all make sense?
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Terry Romine: "[PHP-DB] finding an empty association"
- Previous message: Hugh Bothwell: "[PHP-DB] Re: check two tables at same time?"
- Next in thread: andy: "[PHP-DB] Re: MySQL query from multiple tables"
- Reply: andy: "[PHP-DB] Re: MySQL query from multiple tables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

