how to write correctly query - BuildShip