سؤال

How can I add COLLATION to the following query....

This Collation clause = COLLATE Latin1_General_CS_AS

I only need to count the St_Text field if it exactly matches.

SELECT St_Text, count(*) as Counter
FROM tblSTBackup
GROUP BY St_Text 
HAVING count(*) > 1

I have tried to add the collation to the GROUP BY.

هل كانت مفيدة؟

المحلول

I think this is how it should look:

SELECT St_Text COLLATE SQL_Latin1_General_CP1_CS_AS, count(*) as Counter
FROM tblSTBackup
GROUP BY St_Text COLLATE SQL_Latin1_General_CP1_CS_AS
HAVING count(*) > 1

SQL Fiddle Demo

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top