On Friday, May 9, 2014 8:52:59 AM UTC-7, [email protected] wrote:
>
> Hello,
> I'm working on a Postgres DB and was stumbling over the following 
> statement I wanted to create with Sequel.
> In fact I just want combine the values of two columns into a collection, 
> but this would be my SQL statement.
>
> SELECT  col1, col2, (ARRAY[col3] || col4) AS col34 , col5 , ... FROM  
> sample_table
>
> Is it somehow possible to create such a statement in Sequel? Or does 
> anybody has an approach how to solve this problem?
>

You can use the pg_array and pg_array_ops extensions:

DB.extension :pg_array
Sequel.extension :pg_array_ops
DB[:sample_table].select(:col1, :col2, 
Sequel.pg_array([:col3]).op.concat(:col4).as(:col34), :col5)

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