// Get a db connection.
$database = JFactory::getDbo();

// Create a new query object.
$query = $database->getQuery(true);

$query
    ->select(array('a.*', 'b.username', 'b.name'))
    ->from($database->quoteName('#__content', 'a'))
    ->join('INNER', $database->quoteName('#__users', 'b') . ' ON (' . $database->quoteName('a.created_by') . ' = ' . $database->quoteName('b.id') . ')')
    ->where($database->quoteName('b.username') . ' LIKE \'a%\'')
    ->order($database->quoteName('a.created') . ' DESC');

$database->setQuery($query);

$results = $database->loadObjectList();
Your Answer
Sign In
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.