Hi!

Using mysql version 4.0.x, and would like to know if it is possible to join in a count(*) from a related table which count the number of corresponding posts in this per post in the first table?

A little like:

table1:
+-------------+----------+
| id              | name   |
+-------------+----------+
| 04002       |   victor |
+-------------+----------+
| 04003       |   pierre |
+-------------+----------+

table2

+-------------+----------+
| id              | relid       |
+-------------+----------+
| 1                | 04002  |
+-------------+----------+
| 2                | 04002  |
+-------------+----------+
| 3                | 04002  |
+-------------+----------+
| 4                | 04003  |
+-------------+----------+

The result I want is:
+-------------+----------+
| id              | count(*) |
+-------------+----------+
| 04002       |   3          |
+-------------+----------+
| 04003       |   1              |
+-------------+----------+

Is this possible?

Sincerely

Victor


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to