使用groupby子句从多个表格中检索数据"而不是groupby表达式"

时间:2016-11-08 06:03:28

标签: mysql sql oracle

TS_PROJECT_CODE

enter image description here

我想获取数据,我希望每个<table align="center"> <tbody> <tr> <td><input type="text" name="username" placeholder="User Name" id="username" autocomplete="off"></td> </tr> <tr> <td><input type="password" name="password" placeholder="Password" id="password" autocomplete="off"></td> </tr> <tr> <td align="right"> <input type="submit" class="btn btn-success" id="loginbutton" value="LOGIN" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="reset" class="btn btn-danger" id="resetbutton" value="RESET"/></td> </tr> </tbody> </table> 的总小时数总和。

1 个答案:

答案 0 :(得分:0)

select
      u.UM_TOKEN_NO,
      u.UM_FULLNAME,
      u.SECTOR,
      u.department_name,
      t.TS_PROJECT_CODE,
      sum(t.TS_TOTAL_HRS)
from prm_user_master u
 INNER JOIN  prm_time_sheet t ON u.UM_TOKEN_NO = t.ts_token_no
where t.ts_week_no BETWEEN 35 and 40
GROUP BY u.UM_TOKEN_NO,u.UM_FULLNAME,
         u.SECTOR,u.department_name,t.TS_PROJECT_CODE;

鉴于除SUM(t.TS_TOTAL_HRS)列之外的select查询中的group by子句中的所有列名称,它工作正常......