public function getSelectSQL($all = false)
        {
            if (!$this->query->getTable() instanceof Table) {
                throw new Exception('Trying to generate sql when no table is being used.');
            }
            $sql = $this->generateSelectSQL();
            $sql .= $this->generateJoinSQL();
            if (!$all) {
                $sql .= $this->generateWhereSQL();
            }

            return $sql;
        }