[odb-users] Self join WHERE value IS NULL
Tom Stoffer
tom at touchsurgery.com
Wed Aug 24 11:37:10 EDT 2016
Thanks for the reply Boris,
Please could you elaborate on your second suggestion. How would you go
about defining a view which checks for no related objects. Please note that
the object I am looking for is inverse, meaning it is not in the database.
So far as I have seen it is not possible to use inverse values in queries?
Maybe I have missed something.
Tom
On Mon, Aug 22, 2016 at 5:36 PM, Boris Kolpackov <boris at codesynthesis.com>
wrote:
> Hi Tom,
>
> Tom Stoffer <tom at touchsurgery.com> writes:
>
> > #pragma db view query("SELECT employee.name FROM employee LEFT
> > JOIN employee_down ON employee.name = employee_down.value WHERE
> > employee_down.value IS NULL")
>
> If you need to test container entries for NULL, then this is the only
> way since there is no support for using container elements in query
> conditions, yet.
>
> In this particular case it is not clear what the benefit of having
> NULL pointers in the container when you could just remove the entry
> altogether. In this case I think you would have been able to test
> this (i.e., no related objects) using a non-native view.
>
> Boris
>
More information about the odb-users
mailing list