I have a simple query to insert content to construct my web pages:
mysql_query("SELECT * FROM table1 ORDER BY date DESC");
In that table are titles, descriptions, links and a unique hash.
What I would like to do is to supplement this data with content from table2.
In table2 I have heights, widths and hashes. While the hashes correspond to the hashes in table1, there can be multiple rows with the same hash. When using this table, I take averages of the widths and heights:
mysql_query("SELECT AVG(width), AVG(height) FROM table2 WHERE hash='$hash'");
I need to associate these two tables together, where I grab the content from table1, as well as the avg width and height for that row from table2 (if there are any).
Beyond this, I don't know what to do:
mysql_query("SELECT * FROM table1, table2 ORDER BY table1.date DESC");
Any help is greatly appreciated. Thanks.