count(distinct col) throws error: what's the correct syntax for distinct count?
20:44 11 Nov 2026

I'm migrating some SQL queries to DolphinDB and a standard count(distinct col) pattern fails. The same syntax works in every other SQL dialect I've used.

t = table(`A`A`B`C`C as sym, 1..5 as val)

// Standard SQL pattern — fails
select count(distinct sym) from t
// Error: ... (syntax error or unsupported)

I understand DolphinDB has its own SQL dialect, but I can't find the correct syntax for a simple distinct count in the docs. What's the right way? And does it work inside group by and context by as well?

// Also need this pattern:
select date, count(distinct sym) from t group by date
sql database dolphindb