Hi,

 Tihs looks to me as too few information.

 What is in your tables (the information)?

 What does the query return (a empty set)? Maybe 'cause in your where clause 
where you have Project_ID >2 you should have Project_ID=2? Or you have 
several projects with ID>2 and you want tasks for all of them?

 Or the query don't even run as Project_ID exists in both table and you should 
specify a table alias (T.Project_ID or P.Project_ID)?

themage

On Sunday 17 October 2004 20:36, shaun thornburgh wrote:
> 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

-- 
Merlin, the Mage
www.code.online.pt
www.cultodavida.online.pt

Que o(s) vosso(s) Deus(es) vos abençoe(m)
E a vida vos ame e proteja

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

Reply via email to