On Wed, Nov 5, 2014 at 10:52 AM, Martin Engelschalk <
[email protected]> wrote:

> Hi Baruch,
>
> in such cases I use one of the following methods:
>
> SELECT col1 FROM table1 WHERE col2=:val or (col2 is null and :val is null)
>
> SELECT col1 FROM table1 WHERE coalesce(col2, '#') = coalesce(:val, '#')
>
> where '#' is a value that i know is never used in col2 (this is a drawback)


Thanks. Assuming col2 is indexed, any idea which is faster (I am guessing
the first, but didn't test)


-- 
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to