mysql queries a bit more in shape