Code snippet

Execute a query and get a lists of objects

$_db is setted on the constructor of the class (not shown here).

class MyTable extends JTable
    var $_db;
    function getSomeObjectsList(){
        $q = "<your query>";
        $rows = $this->_db->loadObjectList();
        return $rows;

$q has an SQL sentence. All needed is to set the query and return the rows. After assigning $rows should be convenient to check for errors.