How do I perform an accent insensitive compare (e with è, é, ê and ë) in SQL Server?

Coerce to an accent insensitive collation You’ll also need to ensure both side have the same collation to avoid errors or further coercions if you want to compare against a table variable or temp table varchar column and because the constant value will have the collation of the database Update: only for local variables, not … Read more

Does T-SQL have an aggregate function to concatenate strings? [duplicate]

for SQL Server 2017 and up use: STRING_AGG() set nocount on; declare @YourTable table (RowID int, HeaderValue int, ChildValue varchar(5)) insert into @YourTable VALUES (1,1,’CCC’) insert into @YourTable VALUES (2,2,’B<&>B’) insert into @YourTable VALUES (3,2,’AAA’) insert into @YourTable VALUES (4,3,'<br>’) insert into @YourTable VALUES (5,3,’A & Z’) set nocount off SELECT t1.HeaderValue ,STUFF( (SELECT ‘, … Read more

Select info from table where row has max date

SELECT group,MAX(date) as max_date FROM table WHERE checks>0 GROUP BY group That works to get the max date..join it back to your data to get the other columns: Select group,max_date,checks from table t inner join (SELECT group,MAX(date) as max_date FROM table WHERE checks>0 GROUP BY group)a on a.group = t.group and a.max_date = date Inner … Read more