0

I count the different x in the table with :

create table tmp as 
select  distinct  x  from balance ;
select count(x) from tmp ;

How can i combine them into one simple sqlite command?

showkey
  • 482
  • 42
  • 140
  • 295
  • possible duplicate of [How can I do a count distinct in sqlite?](http://stackoverflow.com/questions/5522607/how-can-i-do-a-count-distinct-in-sqlite) – Joe Jun 01 '14 at 09:37
  • no ,`select distinct x,count(x) from cash ;` can not work for me,it is a wrong result,and `select x,count(x) from cash ;` too . – showkey Jun 01 '14 at 09:41
  • 1
    `select count(DISTINCT x) from cash;` can work for me,thinks . – showkey Jun 01 '14 at 09:46
  • possible duplicate of [SQL to find the number of distinct values in a column](http://stackoverflow.com/questions/141562/sql-to-find-the-number-of-distinct-values-in-a-column) – CL. Jun 01 '14 at 10:03

0 Answers0