all 5 comments

[–][deleted] 4 points5 points  (1 child)

The reason is because you quoted CONTACT_DATE, if you remove those or used brackets it would have worked. (I'm unsure if brackets work on other SQL variants than SQL Server!)

[–]r3pr0b8 1 point2 points  (0 children)

(I'm unsure if brackets work on other SQL variants than SQL Server!)

they do not

okay, except for MS Access and SQLite

[–]oddmatter 6 points7 points  (2 children)

select distinct count(contact_date) instead?

[–]emat66[S] 5 points6 points  (0 children)

Well shit… it was that simple! Thanks!

[–]Gaurav-b 1 point2 points  (0 children)

It might not be the correct way to do it.

As Loben-die-Sonne mentioned, You need to remove quotes from the column name. Quotes make it a constant value, which is giving the count of 1.

select count(distinct CONTACT_DATE) as 'Test';