Skip to content
Advertisement

Add a variable in syntax

In this example which runs here live

I would like to add the user id in the retrieved data

I use this

But I receive this error: Column ‘votes.UserId’ is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.

How can I fix it?

Advertisement

Answer

You forgot to add userid in your group by list. So your updated query might look like –

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement