----- Original Message ----- From: "Luis Lebron" <[EMAIL PROTECTED]> > The data tables look like this: > > Manhours > mid | ProjectId |ChargeNum | Catid | Hours | EmployeeId > > 1 | 32 |111111 | 19 | 80 |200020 > 2 | 32 |111111 | 19 | 24 > |200003 > > > Tasks > TaskID |ChargeNum |Catid |EmployeeId |Hours > 1 |111111 |19 |200020 |8 > 2 |111111 |19 |200020 |8 > 5 |111111 |19 |200003 |12 > > > By looking at the Manhours table I can tell that for ProjectId 32 I have 104 > (80+24) hours alloted for Catid 19 > By looking at the Tasks table I can tell that 36 hours (8 + 8 + 8 + 12) have > been used on this project (same ChargeNum as Manhours table) > and Catid 19
I can't see any solution that uses a single query for this. You want to link sumarised info from one table to summarised info from another table. If you need to do it with queries, the only way I see to do this, is to have one query gather info from the Manhours table and store it in a temporary table. Then you can join the temporary table with the Tasks table. Regards, Jigal. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]