15
Views
5
Comments
Get all user in advance SQL
Question

Hi Everyone,


In this question I have to ask, how to get all User, I use "*" but I got an error 

I show the message error and line the intended error




Rank: #285

Hi,


You cannot user Alias "User" because this is reserved keyword.


Thanks

Rank: #68

Hi Kane,


Besides the incorrect user of reserved keyword user as an alias as pointed out by Toto, if you are grouping by fields (in this case username,) your SELECT instruction should include the fields that are on grouped or aggregations like MAX, COUNT or AVG. This is what the error message is explaining.

Being that the case, either you remove the GROUP BY {User}.[Username] or add the fields to select as you have on Group and adjust the output structure to match the query output.


Why are you grouping by username in the first place? Depending on what you want to achieve, there are better ways of doing this and probably not even the need of using advanced SQL.


Hope it helps.

Regards,

João