On 18 Feb 2016, at 5:42am, <admin at shuling.net> <admin at shuling.net> wrote:

> Then I want to obtain the total count of unique values for F1 field. In the
> above sample, since unique F1 field values are 1, 2, 3 and 4, so the count
> is 4. How to write SQL query to obtain the value?

First, get a list of the unique values:

SELECT F1 FROM MyTable GROUP BY F1

then count them

SELECT count(*) FROM (SELECT F1 FROM MyTable GROUP BY F1)

The above code is just from my head.  I have not tested it.

Simon.

Reply via email to