我有3个表(spentTime,estimatedTime,plannedTime),所有表都有相同的列:
+---------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| hours | double | YES | | NULL | |
| projectId | int(11) | YES | | NULL | |
| projectName | varchar(255) | YES | | | |
| userLogin | varchar(255) | YES | | | |
| userFirstname | varchar(30) | YES | | | |
| userLastname | varchar(255) | YES | | | |
+---------------+--------------+------+-----+---------+-------+
我需要为每对夫妇(projectId; userId)创建一个代表 sumed 花费,计划和估计时间的VIEW。该观点应具有该结构:
+---------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| spenthours | double | YES | | NULL | |
| estimatedhours| double | YES | | NULL | |
| plannedhours | double | YES | | NULL | |
| projectId | int(11) | YES | | NULL | |
| projectName | varchar(255) | YES | | | |
| userLogin | varchar(255) | YES | | | |
| userFirstname | varchar(30) | YES | | | |
| userLastname | varchar(255) | YES | | | |
+---------------+--------------+------+-----+---------+-------+
我尝试了许多连接组合(使用一些StackOverFlow文章)但我无法达到我想要的效果。需要一些帮助。
由于