On Monday, May 8, 2017 at 1:55:41 PM UTC-7, Mark Cyzyk wrote:
>
>
> Here's a question:
>
> The documentation provides the following example of issuing a SQL LIKE
> clause against a dataset:
>
> ds2 = ds1.where(Sequel.like(:name, 'A%'))
>
> But what if *A* is a variable, not hardcoded? What is the syntax?
>
>
I assume basic interpolation will work:
ds2 = ds1.where(Sequel.like(:name, "#{var}%"))
If you mean variable as in a reference to another column or SQL expression,
Sequel can do that:
ds2 = ds1.where(Sequel.like(:name, Sequel.join([:a, '%'])))
Thanks,
Jeremy
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.