Problem/Motivation

Add an optional WHERE condition to MIN/MAX to enable narrowing down the results within the subquery.

Example:

$webformQuery = \Drupal::service('webform_query');
$results = $webformQuery->addCondition('webform_id', ['webform_one', 'webform_two', 'webform_three'], 'IN', 'webform_submission')
    ->addCondition('uid', 1, '=', 'webform_submission')
    ->addMinMax('MAX', 'webform_submission', 'webform_id', ['uid', '=', '1']) // MAX sid in webform_submission table, where UID = 1, grouped by webform ID.
    ->orderBy('created', 'ASC', 'webform_submission')
    ->processQuery()->fetchCol();

Comments

imclean created an issue. See original summary.

imclean’s picture

Issue summary: View changes
imclean’s picture

Issue summary: View changes
imclean’s picture

imclean’s picture

Status: Active » Needs review

  • imclean committed 4aaeff9 on 8.x-1.x
    Issue #3241211 by imclean: Add WHERE condition to MIN/MAX
    
imclean’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.