On Wednesday, June 11, 2014 9:21:02 AM UTC-7, Neil wrote:
>
> For the equivalent of this SQL query,
>
> select * from Table where col1 = 'desiredvalue' order by RAND() limit 1
>
> I'm writing the following Sequel statement:
>
> Table.first(col1: 'desiredvalue').order(Sequel.lit('RAND()'))
>
> Is this correct?
>

No.  Dataset#first returns a row, not a dataset.  You probably want:

Table.order{rand{}}.first(col1: 'desiredvalue')

Note that this uses the the virtual row form instead of a literal string.

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 http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to