How to use MySQL DISTINCT with JDatabase? - Joomla! Forum - community, help and support
code: select all
function getworkorders(){
$db = jfactory::getdbo();
$query = $db->getquery(true);
$query->select(array('#__workorder.*, #__workorder_tasks.*'));
$query->from('#__workorder');
$query->join('left', '#__workorder_tasks on (#__workorder.w_id=#__workorder_tasks.w_id)');
$db->setquery($query);
$results = & $db->loadobjectlist();
return $results;
}
i didn't see examples using distinct.
http://docs.joomla.org/accessing_the_da ... ple_tables
and wondering if provide quick example.
thanks.
you can encode query on string
$query = 'select distinct `this1`, `this2` .... ';
and assign on query
$db->setquery($query);
$query = 'select distinct `this1`, `this2` .... ';
and assign on query
$db->setquery($query);
Comments
Post a Comment