hello Matthew:

if I understood your problem right, you have to join the two tables.

E.g:

SELECT
    ph.*,
    pf.prod_ID,
    pf.feat_ID,
    pf.feat_value
FROM
    product_head ph,
    product_features pf

WHERE
    ph.prod_cat_ID = 1
    AND ph.prod_cat_ID = pf.prod_cat_ID /*join the two tables with the same
id*/
    AND pf.yourcriteria = whatever /* put your criteria for table 2 here*/

Hope this helps a bit,

Andy

--
----------------------------------------------
http://www.globosapiens.net
Global Travellers Network


"Matthew Nock" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]...
> 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

Reply via email to