Join two mysql tables

Bendensulge

New Member
I have two databases - one for articles and the another for the articles' meta information (Like author, date, category and atc.). I have the following columns in meta table: ID, article id, meta type and meta value. I wonder how can I join these two tables to get both - article and meta information - with one mysql query. The article id isn't unique in meta table, that is why I can't figure out how to access specific meta type and according value for the article...Here is the mysql I'm tried to use:\[code\]SELECT products.*, product_meta.meta_valueFROM productsLEFT JOIN product_meta ON products.ID = product_meta.product_id\[/code\]but this query doesn't seem to be what I need. I there are for example two records in articles table and ten in meta table this code displays ten results instead of two:\[code\]$products = mysql_query("SELECT products.*, product_meta.meta_value FROM products LEFT JOIN product_meta ON products.ID = product_meta.product_id") or die(mysql_error());while ($product = mysql_fetch_assoc($products)) { echo $product["title"];}\[/code\]Can anyone please help?
 
Back
Top