improved sql query performance (subselects)
Merge pull request #535 from naturwerk/emin

improved sql query performance (subselects)