Database: fixed Selection as condition in subselect [Closes #288]