Skip to content

Tag: sql-server

JSON_Query with For Json Path

Please see the table given below. The table contains the json string and need to create a json array with those json string. But When I use JSON_Query and For Json Path it adds additional header. (Alias name or the source column name). How to generate the json array without alias name or source column name. P…

Select Distinct Top One Record by Date

I am writing a script to compare software between servers but have a many-to-many relational situation to execute this cleanly. I’m thinking a distinct-top by latest date type of query may help. So that I can go from this To this shortened and clean list I am not exactly sure how to approach this? Shoul…

SQL How to avoid groupby

I have this query that it results is not correct and I assume it groupby issue Fiddle This is my dbfiddle Query Result Expected In reality only user1 has done 4 requests Answer Your result shows one registry with ‘Title1’. Per registry you can have many users (in table RegistryMember). And per reg…