distinct count over partition by sql