Re: Using pg_arrays operations in join conditions

2020-04-07 Thread Marcelo Pereira
Aha! Got it. Thank you very much! Best On Tue, 7 Apr 2020, 21:17 Jeremy Evans, wrote: > On Tuesday, April 7, 2020 at 11:11:59 AM UTC-7, Marcelo wrote: >> >> Hello, >> >> I'm trying to produce this query with Sequel, that would then run on >> PostgreSQL: >> SELECT o.id, coalesce(cg.price,

Re: Using pg_arrays operations in join conditions

2020-04-07 Thread Jeremy Evans
On Tuesday, April 7, 2020 at 11:11:59 AM UTC-7, Marcelo wrote: > > Hello, > > I'm trying to produce this query with Sequel, that would then run on > PostgreSQL: > SELECT o.id, coalesce(cg.price, o.price) price > FROM offers o > LEFT JOIN country_groups cg ON cg.offer_id = o.id AND

Using pg_arrays operations in join conditions

2020-04-07 Thread Marcelo
Hello, I'm trying to produce this query with Sequel, that would then run on PostgreSQL: SELECT o.id, coalesce(cg.price, o.price) price FROM offers o LEFT JOIN country_groups cg ON cg.offer_id = o.id AND cg.country_codes @> '{"US"}' I understand I can use an array of conditions, as follows: