Skip to content

Instantly share code, notes, and snippets.

@filbertkm
Created March 12, 2014 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filbertkm/9502604 to your computer and use it in GitHub Desktop.
Save filbertkm/9502604 to your computer and use it in GitHub Desktop.
subquery in mediawiki
$select = $this->dbw->selectSQLText(
'user_properties',
array( 'up_user', 'up_property', 'up_value', 'count(up_user) as count' ),
'up_property=' . $this->dbw->addQuotes( $oldOption ) . ' OR up_property = ' . $this->dbw->addQuotes( $newOption ),
__METHOD__,
array( 'GROUP BY' => 'up_user' )
);
$result = $this->dbw->select(
"( $select ) as user_props",
array( 'up_user' ),
array( 'count' => 1 ),
__METHOD__
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment