Re: [sqlite] ORDER BY and NULL values

2009-04-19 Thread Igor Tandetnik
"January Weiner" 
wrote in message
news:454237550904191253i7b56d4b3qb649ec7815217...@mail.gmail.com
> default sorting with ORDER BY puts the NULL values at the beginning.
> How can I change this behaviour?

select * from myTable
order by (b is null), b;

Igor Tandetnik 



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


Re: [sqlite] ORDER BY and NULL values

2009-04-19 Thread Stephen Oberholtzer
select * from MyTable
order by case when b is null then 0 else 1 end, b

On Sun, Apr 19, 2009 at 3:53 PM, January Weiner wrote:

> Hello,
>
> default sorting with ORDER BY puts the NULL values at the beginning.
> How can I change this behaviour? I.e., instead of
>
> a   b
> -   
> x  NULL
> y  0
> z  2
>
> I would like to have
>
> a  b
> 
> y  0
> z  2
> x  NULL
>
> Explanation: I have a table with e-values (expected number of
> something). A lower e-value means a more significant search hit. No
> evalue at all means that hit was not found, so that the missing
> e-values should be reported at the end (unfortunately, I want to have
> them reported, but just not at the beginning).
>
> Thank you in advance,
>
> j.
>
> --
> -Dr. January Weiner 3  -+---
> Inst. of Bioinformatics, UKM, Univ. of Muenster | Von-Esmarch-str. 54
> (+49) (251) 83 53002| D48149 M√ľnster
> http://www.compgen.uni-muenster.de/ | Germany
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
-- Stevie-O
Real programmers use COPY CON PROGRAM.EXE
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users