Subject RE: [firebird-support] Strange plan? Bug?
Author Leyne, Sean

> >I do expect more than on PLAN dues to the derived table and the union,
> >but there seems to be a comma missing before the PLAN on line 05 at least.
> >
> >I don't really need to understand the plan, but I wanted to bring it up
> >in case there's a bug that needs to be fixed...
> Hi Kjell, I doubt this is an error. The place you think a comma is missing, is
> where your UNION is. I must admit that I've never before really noticed
> whether or not there is a comma in the plan with union, but when I try

Adding to Set's typically excellent comments, I would suggest that you look at using Common Table Expression (CTE) for your FE Företag inner join.

The reason that the PLAN is showing a NATURAL access for FE Företag is because the SELECT from Företag is not getting the JOIN criteria, using a CTE would change that.