I have converted mysql query to a SQL Server T-SQL query, and when I run this query, I get an error:
Column invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Here is my query, can anyone please tell me why I am getting this error ?
SELECT
t.id, t.value, t.branch_id, k.name
FROM
tb_target as t
LEFT JOIN
tb_keyindicator as k ON k.id = t.keyindicator_id
WHERE
t.branch_id IN (241)
AND t.period >= '2017-09'
AND t.period < '2017-10'
GROUP BY
branch_id;