On Tuesday, June 17, 2014 8:02:34 AM UTC-7, Joachim Nolten wrote: > > In PostgreSQL it is possible to order the results of a query according to > a list of values like below. How would this be best implemented using > Sequel syntax? > > select c.*from comments cjoin ( > values > (1,1), > (3,2), > (2,3), > (4,4)) as x (id, ordering) on c.id = x.idorder by x.ordering > > Sequel doesn't currently have DSL support for VALUES, so you would need to do something like:
DB[:comments___c]. select_all(:c). join(DB['VALUES (1,1), (3,2), (2,3), (4,4)'].as(:x, [:id, :ordering]), :id=>:id). order(:x__ordering) 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.
