PostinstallModelMessages::buildQuery

Builds the SELECT query