On Saturday, January 16, 2016 at 3:33:08 AM UTC-8, Rodrigo Rosenfeld Rosas wrote: > > PostgreSQL supports this feature and sometimes I wonder if it would be > possible to write queries like this in Sequel: > > select 123 as id > union select id from ... > > Currently I end up by doing the concatenation in the Ruby side for such > queries, but there are some other cases where it would be useful if I was > able to perform such operations like in some recursive CTE for example... > > Is there anyway to write a query which is not tied to any table? I noticed > something like DB['select 123 as id'].union(...) works, but maybe there's > some other way to achieve the same without writing the full select. Is > there? >
DB.select(Sequel.as(123, :id)).union(DB[:table].select(:id)) 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.
