I have a working query against postgresql that I was hoping to convert to Sequel. I've been using sql for more years than I can count, but this is my first use of a nested join. There may be another way to do it. But here is what I have, which returns the expected data:
SELECT a.*, b.info FROM api as a left outer join (m_tuples as m inner join api as b on b.event_id=m.event_id and b.r_id=15) on a.m_id=m.m_id where a.r_id = 27 A simple representation of the tables should be: api event_id, m_id, r_id, info m_tuples: event_id, m_id For the same m_id, there is at least a set of rows from api with r_id=27. There may also be a set of rows with r_id=15, so first it constructs a virtual table that ties m_tuples to api on event_id constrained to r_id 15, then left outer joins the api(a) to it. fwiw, api to m_tuples is a one-to-many for r_id 15, but unused for r_id 27. I spent some time looking at the Dataset join methods and searching for ruby sequel nested joins, but came up empty handed. I noticed there was something about 'join_clause_sql_append', but I suspect that is not for this purpose and could find no example of it's use. Many thanks, Dan -- 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.
