Written
In the example below we show how you can build a complex SELECT statement with 1 table JOIN, we use Joomla's core content and users tables to retrieve the results we need:
<?php \GCore\Libs\Model::generateModel('User', array( 'tablename' => '#__users', )); \GCore\Libs\Model::generateModel('Article', array( 'tablename' => '#__content', )); $Article = \GCore\Models\Article::getInstance(); $Article->bindModels('belongsTo', array( 'User' => array( 'className' => '\GCore\Models\User', 'foreignKey' => 'created_by', 'join_conditions' => array('User.id = Article.created_by'), ), )); //the next lines will return both articles data and their authors data //$articles = $Article->find('all'); //find all articles //$articles = $Article->find('count'); // get articles count $articles = $Article->find('all', array('order' => array('Article.id'), 'conditions' => array('Article.state' => 1), 'limit' => 5)); // customize your query pr($articles); // display some output