I have a database (MSSQL) with a table as follows:
CREATE TABLE [dbo].[Ciphers](
[Time] [datetime] NULL,
[Hostname] [varchar](50) NULL,
[ClientIP] [varchar](50) NULL,
[UserAgent] [varchar](550) NULL,
[CipherName] [varchar](200) NULL,
[CipherVersion] [varchar](100) NULL,
[CipherBits] [varchar](50) NULL
) ON [PRIMARY]
A couple of rows can look like this:
Now I want to count the number of occurrences of the combination of CipherName, CipherVersion and CipherBits for each top level domain.
Almost like this:
SELECT CipherName, CipherVersion, CipherBits, COUNT(ClientIP) As "Hits"
from Ciphers
WHERE Hostname like '%domain.com'
Group by CipherName, CipherVersion, CipherBits
The crux is that I only want to count unique instances of each client IP. That is, if a customer has browsed to sub.domain.com and test.domain.com I don't want to count this as two, just one.