Count: SELECT [ProductModel], COUNT(1) CNT FROM [AdventureWorks2017].[Production].[vProductAndDescription] GROUP BY [ProductModel] ORDER BY CNT DESC Count "if": SELECT [ProductModel], [Name],COUNT(1) CNT FROM [AdventureWorks2017].[Production].[vProductAndDescription] WHERE [ProductModel] LIKE '%Frame' AND [Name] LIKE '%52' --here's the IF statement GROUP BY [ProductModel], [Name] ORDER BY CNT DESC Count duplicates: SELECT [ProductModel], COUNT(1) CNT -- select a field you want to … Continue reading Examples of Count, Count IF, Count duplicates in SQL
I had to install a copy of SQL Server 2005 on a Windows Server 2003 R2 SP2 x64. During installation I got a strange error saying that SQLncli_x64.msi file is missing. I was pretty sure that I have the same ISO file as I did while installing SQL so many times before and without any … Continue reading Install SQL Server on a 64 bit Windows Server–missing SQLncli_x64.msi
Today I again learned a lesson I knew for some time but was hoping that I can forget it. The lesson was about: “Trust anyone. Test for yourself.” Having to install WSUS on a remote SQL 2005 that had WSUS database installed before, I asked one SQL guy if renaming the old WSUS database is … Continue reading Problem installing WSUS on a remote SQL server.