- $query = "SELECT *, COUNT(*) as count
- FROM table_1, table_2
- WHERE table_1.column = table_2.column
- GROUP BY table_1.column
- ORDER BY table_1.column";
- $result = mysql_query ($query) or die ("Invalid query: " . mysql_error());
- while ($row = mysql_fetch_array ($result))
- { echo $row["column"] . " - " . $row["count"] . " штук" }