GROUP BY ALL


Mais uma que não conhecia, sempre temos algo para aprender 🙂

O GROUP BY ALL mostra a soma dos valores “ZERADOS” desconsiderando o filtro do WHERE

SELECT collation_name as COLLATION, COUNT(*) as [COUNT]
FROM sys.databases
WHERE collation_name = 'SQL_Latin1_General_CP1_CI_AS'
GROUP BY ALL collation_name

COLLATION                    COUNT
---------------------------- -----------
Latin1_General_CI_AS         0
Latin1_General_CI_AS_KS_WS   0
SQL_Latin1_General_CP1_CI_AS 5

(3 row(s) affected)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s