Hi Jeremy,

I want to add more conditions to inner join after ON but it appends and 
treat as array instead of merging conditions.

Let me show you the full query builder:

 DB[:full_paths].
  select(:id, :subject).
  cross_join(:pattern).
  where{{:idx=>cardinality(:pattern)}}.
  with(:pattern, DB.select{string_to_array("folder_2/SUB iso", '/')}, :args
=>[:pattern]).
  with_recursive(:full_paths,
    DB[:folders].
      select(:id, :base_folder_id, :subject, Sequel[1].as(:idx)).
      cross_join(:pattern).
      where(:user_id=>24).
      where{subject.ilike(pattern.sql_subscript(1))},
    DB[Sequel[:folders].as(:x)].
      select(:id, :base_folder_id, :subject, Sequel[:idx] + 1).
      cross_join(:pattern).
      join(Sequel[:full_paths].as(:y), :id=>:base_folder_id){Sequel.expr{x[:
subject].ilike(pattern.sql_subscript(idx+1))}}
  )


What I want to add here: (last line)

      join(Sequel[:full_paths].as(:y), :id=>:base_folder_id){Sequel.expr{x[:
subject].ilike(pattern.sql_subscript(idx+1))}}


more conditions which is:

x.user_id = 24

Currently this line produces:

INNER JOIN full_paths AS y ON ((y.id = x.base_folder_id) AND (x.subject 
ILIKE pattern[(idx + 1)] ESCAPE '\\'))))


What I want is:

INNER JOIN full_paths AS y ON ((y.id = x.base_folder_id) AND (x.user_id = 4) 
AND (x.subject ILIKE pattern[(idx + 1)] ESCAPE '\\'))))


How can i make multiple conditions for this join (not where but via ON)

Thanks,
Gencer.

-- 
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 sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to