working on horrid petra db well query