Some Sequel dataset methods will return another dataset, and some are 
terminal (they'll execute the query immediately and return the result). In 
this case, the `count` method on a dataset is terminal and meant to be at 
the end of the line.

If you're looking for something more akin to SQL, then you can manually 
build your query and then extract out of it. It's probably not how I'd do 
it tho.

        ds.select { count(id) }.where(kind: "yellow").single_value


On Thursday, January 2, 2020 at 11:13:40 AM UTC-5, BeeRich33 wrote:
>
> Hi folks.  I'm new to Sequel.  I'm having a hard time trying to count 
> qualified records in a working dataset, *ds*:
>
> puts ds.count(:id).where(kind: 'yellow').sql    # => undefined method 
> `where' for 115:Integer (NoMethodError)
>
> Is my syntax wrong?  I can't generate sql for it as it throws an error.
>
> Is this improper syntax?  Any help appreciated.
>
> Cheers
>
>
>

-- 
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/1b465f77-dd4d-4614-b9b3-dbbeb973e336%40googlegroups.com.

Reply via email to