On Sat, Jun 26, 2010 at 7:27 AM, zhangzhenggui <zhangzheng...@126.com>wrote:
> tbl_test maybe like this: > create table tbl_test(f1, f2, f3); > > Now, I want to get the num of records which (f1, f2) are distinct. > > I try "select count(distinct f1, f2) from tbl_test", but error occur: SQL > error: wrong number of arguments to function count() > > > although, I can do like this, but I think it not very good : > select count(1) from (select distinct f1, f2 from tbl_test); > > If you know the type and the maximum range (in case of integer) you can do the tricks like this select count(distinct ((Value1 << 32) | Value2)) FROM TestTable but I did quick text for a table consisting of thousands of integers, the speed is similar to your another query that you called not very good. I think both needs some temporary storage, so what you like aesthetically is the best :) Max _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users