Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2011-04-06 : 11:07:47
|
| I am trying to use the following query, made sure with joins etcselect t.contractid, t.taskid, isnull(sum(c.amount),0) from tab_tasks t inner join tab_cost c on (t.TaskID = c.TaskID and t.Contractid=136)Msg 8120, Level 16, State 1, Line 1Column 'tab_tasks.ContractID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.Thank you very much for the helpful info. |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-04-06 : 11:09:01
|
| SELECT t.contractid, t.taskid, ISNULL(SUM(c.amount),0) FROM tab_tasks t INNER JOIN tab_cost c ON (t.TaskID = c.TaskID AND t.Contractid=136)GROUP BY t.contractid, t.taskid |
 |
|
|
|
|
|