Skip to main content
1 of 2
Nagarjun
  • 3k
  • 9
  • 25
$db = JFactory::getDbo();
$query = $db->getQuery(true)
  ->select('user.firstname, user.lastname, leadership.leadname, leadership.lead_des')
  ->from('CLUB,LEADERSHIP,USER')
  ->where('CLUB.CLUB_ID=11')
  ->where('LEADERSHIP.USER_ID=USER.USER_ID')
  ->where('CLUB.CLUB_ID=Leadership.CLUB_ID');

Multiple where clauses by default clubbed with AND.

From Joomla API docs for JDatabaseQuery->where function:

string $glue - The glue by which to join the conditions. Defaults to AND. Note that the glue is set on first use and cannot be changed.

Or the alternative is you can manually combine in single where clause

$query = $db->getQuery(true)
  ->select('user.firstname, user.lastname, leadership.leadname, leadership.lead_des')
  ->from('CLUB,LEADERSHIP,USER')
  ->where('CLUB.CLUB_ID=11 AND LEADERSHIP.USER_ID=USER.USER_ID AND CLUB.CLUB_ID=Leadership.CLUB_ID');
Nagarjun
  • 3k
  • 9
  • 25