On 18/06/2014, at 5:54 pm, David M. Cotter <d...@kjams.com> wrote:

> i have a table with a numeric column (not the key column)
> i want to obtain from this table a list of unique numbers appearing in that 
> one column
> 
> some cells in the column may have nothing, some may have duplicate numbers eg:
> 
>> 1
>> 1
>> 1
>> 4
>> _
>> _
>> 4
>> _
> 
> note that "_" means "no data". i want to get a list with [1, 4] as the 
> result.  what is the proper SQLite query for this?

SELECT DISTINCT column FROM table;

This will return a row for each unique value in table.column, with the values 
in no particular order.

Eliminating the "no data" entry can be done by checking the results, or if you 
want to eliminate it automatically you could use something like:

SELECT DISTINCT column FROM table WHERE column not NULL;

This assumes your "no data" is represented as NULL. If you have used something 
else to represent "no data" then you would need to compare against that.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to