Hello

Could you tell me how to write ``like s.col1 || '%'`` join statement with 
sequel?

I would like to write following query with sequel.
I wrote it except ``like join`` statement. 

* DB: PostgreSQL 9.4.5
* Sequel: 4.28.0

Thank you for your advice.

 SELECT col1, col2,count(*)
   FROM ( SELECT s.col1,col2
            FROM data_table1 l,
                 rel_table s
           WHERE l.path like s.col1 || '%'
        UNION ALL
       SELECT s.col1,col2
         FROM data_table2 l,
              rel_table s
        WHERE l.path like s.col1 || '%'
  ) as test GROUP BY col1,col2;



db[:data_table1].select(:col1,:col2)
  .union(db[:data_table2].select(:col1,:col2),:all=>true)
  .group_and_count(:col1,:col2) 


--
Hiroyuki Sato.
  

-- 
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