I have the following piece of code which i taken from model,
... $select = $this->_db->select() ->from($th
you can print..
print_r($select->assemble());