Objective

How to make a select query in several tables in Joomla PHP pages.

Example:

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('a.*', 'b.username', 'b.name'));
$query->from($db->quoteName('#__content', 'a'));
$query->join('INNER', $db->quoteName('#__users', 'b') . ' ON (' . $db->quoteName('a.created_by') . ' = ' . $db->quoteName('b.id') . ')');
$query->where($db->quoteName('b.username') . ' LIKE \'a%\'');
$query->order($db->quoteName('a.created') . ' DESC');
$db->setQuery($query);
$results = $db->loadObjectList();


See also:

Source:

 

Keep Me Informed

Keep me informed of the latest extensions releases and offers. One email maximum per month.

Offer Me A Coffee!

If you like my work, offer me a coffee! Nick.