Respectfully in order On Wed, Jan 8, 2020 at 8:56 AM BeeRich33 <[email protected]> wrote:
> You need to ask questions before accusing people. That is plain outright > rude. > > See, there are obviously multiple websites. Did you know that? I spend > lots of time reviewing here: > > http://sequel.jeremyevans.net/rdoc/files/doc/dataset_filtering_rdoc.html > > So have some respect. I'd love to not wait for anybody to get back to > me. > > Nowhere on those pages, does it say anything about not returning empty > fields. > > DBS[:searches_t]. > where{(:search_phrase != nil) & (:client_ip != '192.168.1.4')}. > select(:search_phrase, Sequel.cast(:creation_date, > DateTime).as(:creation_date), :search_type, :result_count). > reverse(:creation_date). > limit(d).sql > > Doesn't resolve properly. > Going to the page you linked - there are 4 instances of != - specifically in a section entitlted - "Negating conditions" - each one of which explains exactly how to accomplish this. Nil is mentioned 4 times on that page - again showing exactly how to get the IS NULL statement - add in the negation concept and you are in business. so from that page .exclude(search_phrase: nil).exclude(client_ip: '192.168.1.4') which equates to where search_phrase is not null and client_ip != '192.168.1.4' Nowhere in the documents does it say anything about this: > > SELECT "search_phrase", CAST("creation_date" AS timestamp) AS > "creation_date", "search_type", "result_count" FROM "searches_t" WHERE true > ORDER BY "creation_date" DESC LIMIT 30 > > > "WHERE true"? > > "Where TRUE" is unnecessary. One wouldn't document how to add something that you don't need. You simply don't write that - your statement works as this. SELECT "search_phrase", CAST("creation_date" AS timestamp) AS "creation_date", "search_type", "result_count" FROM "searches_t" ORDER BY "creation_date" DESC LIMIT 30 However, if you would like that string - I believe the section entitled "Filtering using a custom filter string" would lead you to something like this .where(Sequel.lit('true') My apologies for trying to point you in the right direction. John W Higgins -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/CAPhAwGw0dH%3DvSucbLRVmAO53QLONdqhTYwP%2Bmzst%3D8Ra1%3D5M-w%40mail.gmail.com.
