Hi,

I have the following two tables in my database:

mysql> DESCRIBE Projects;
+--------------+--------------+------+-----+---------+----------------+
| Field        | Type         | Null | Key | Default | Extra          |
+--------------+--------------+------+-----+---------+----------------+
| Project_ID   | int(11)      |      | PRI | NULL    | auto_increment |
| Client_ID    | int(11)      | YES  |     | NULL    |                |
| Project_Name | varchar(100) | YES  |     | NULL    |                |
+--------------+--------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

mysql> DESCRIBE Tasks;
+------------+-------------+------+-----+---------+----------------+
| Field      | Type        | Null | Key | Default | Extra          |
+------------+-------------+------+-----+---------+----------------+
| Task_ID    | int(11)     |      | PRI | NULL    | auto_increment |
| Task_Name  | varchar(40) |      |     |         |                |
| Project_ID | int(11)     |      |     | 0       |                |
+------------+-------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

mysql>

A Project will have 1 or more tasks assigned to it. Using the following query, how can I modify it so that I can find out the largest number of tasks assigned to a group of projects.

SELECT P.*, T.*
FROM Projects P, Tasks T
WHERE P.Project_ID = T.Project_ID
AND Project_ID > 2;

So if Project A has 3 tasks and Project B has 4 tasks I need the query to return 4.

Hope this makes sense!

Thanks for your help



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



Reply via email to