I thought I tried where by_or_on is not null to start with and it didn't SEEM to work hence the <> ''. However...I've just replaced <> '' with IS NOT NULL and it works fine so I'm a bit mystified Thanks for the advice all the same though
On 3 February 2013 10:08, Petite Abeille <petite.abei...@gmail.com> wrote: > > On Feb 3, 2013, at 10:55 AM, e-mail mgbg25171 <mgbg25...@blueyonder.co.uk> > wrote: > > > (select * from calls where by_or_on <> '') c > > For the record… one thing to watch out… the empty string (aka '') and null > are not the same… so if you are looking to eliminate nulls you have to use > 'foo is not null'… as oppose to "foo != ''" for empty strings… in general, > if you wish to maintain your sanity, do *not* use empty strings… just > saying… > > http://en.wikipedia.org/wiki/Null_(SQL) > > All in all, you could rewrite your join along the following lines: > > select firms.* > from firms > > join calls > on calls.firm_id = firms.id > and nullif( calls.by_or_on, '' ) is not null -- FIXME: suspicious use > of the empty string... > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users