Writing Sql Command Count Distinct Subsequences