Thanks Jeremy. That works!

On Friday, October 21, 2022 at 10:31:53 PM UTC+5:30 Jeremy Evans wrote:

> On Fri, Oct 21, 2022 at 9:50 AM abhijit <ma...@abhij.it> wrote:
>
>> Hi,
>>
>> I have multiple dataset queries. What would be the best way to create a 
>> union in this scenario?
>>
>> I have tried -
>>
>> ds1.union(ds2.union(ds3.union)))
>>
>> as well as
>>
>> ds1.union(ds2).union(ds3)
>>
>> In either case, the resulting SQL looks unnecessarily nested, although 
>> the results are identical.
>>
>> Is there a better way?
>>
>
> You probably want:
>
> ds1.union(ds2, from_self: false).union(ds3, from_self: false)
>
> By default, unions are wrapped in a subselect so that filtering and other 
> changes on the resulting dataset works as expected.
>
> 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 sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/8ecafce7-613f-4d7a-84f3-16a61376d2edn%40googlegroups.com.

Reply via email to