Sorin,

> If there are entries which are:
> 60  / amg / 5
> 120 / amg / 5
> (in this example '5' is the id of the calculation-subproject)
> Then the result should be:

> +-------+-------------------------------+---------------+-----------+
> | login | name                          | name          | minutes   |
> +-------+-------------------------------+---------------+-----------+
> | amg   | Railcalc                      | calculation   | 180       |


> That means I need the SUM of the minutes which belong to a subproject 
> and a certain user.

Okay, here for another wild guess:

SELECT u.login, p.name, sp.name, SUM(t.time)
FROM t_user u
LEFT JOIN t_project p ON 1
LEFT JOIN t_subproject sp ON p.id = sp.project_id
LEFT JOIN t_time t ON ?? = ??
WHERE u.login = 'amg'
GROUP BY p.name

Where I'm not sure if you will need the WHERE clause at all.

Regards,
--
  Stefan Hinz <[EMAIL PROTECTED]>
  iConnect GmbH <http://iConnect.de>
  Heesestr. 6, 12169 Berlin (Germany)
  Telefon: +49 30 7970948-0  Fax: +49 30 7970948-3

[filter fodder: sql, mysql, query]


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to