Subject Re: Interesting results with joined views (WI-V6.2.972, fb1.0.3)
Author Svein Erling Tysvær
Hi again, Semp!

> Hi,Svein Erling.
>
> Thanks for replying.
>
> I guess you meant:
>
> create view v_a (
> id,
> mgrid,
> SempTestUniqueName
> )
> as
> select a.id, a.mgrid, b.empid
> from t_a a
> left outer join t_c c on a.mgrid = c.mgrid
> join t_b b on b.empid = c.empid
> ;

Yes, that should be it.

> Unfortunately, the results stay the same.
>
> Playing around a bit with different view approaches and types of
> joins, it seems the OUTER join is the problem.
>
> If I either create the view with the last join as "join" and
> not "left outer join", the view works as expected.

Didn't you just say that the results stayed the same with the above
changes? If so, the last outer join was replaced by an inner join.

> So, the fact is that as long as I want to use (left) outer joins, I
> have to inner join the result with a table whos fields I may not
> even need, in order for the view to return the correct values?

Maybe it could be because you do not select anything from t_c in the
view at all and then use two outer joins rather than one outer join
and one inner join to reach t_b?

> Sounds buggy to me.

Agreed, though there may be a reason if what I wrote in the last
paragraph is correct. Hopefully some of the female gurus, mr Bamsemums
or some Fb expert who is more of the quiet type will either tell the
reason or that you should report it as an error...

> The fun part is that with the broken view, I get results like:
>
> select mgrid, empid from v_a where id = 1;
> MGRID EMPID
> ============ ============
>
> 871172 10000
>
> select mgrid, empid from v_a where id = 1 and empid is null;
> MGRID EMPID
> ============ ============
>
> 871172 <null>
>
> "What's your name, girl?"
> "Whatever you want it to be!"

If only names had been that easy. Then I could just have called
everybody "you/him/her" and used my spare brain capasity remembering
what my wife told me not to forget ;o)

Set