split Query part of it to Sql class; static and object part.