WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API\Reports\Categories

DataStore::add_sql_query_params() protected WC 1.0

Return the database query with parameters used for Categories report: time span and order status.

{} It's a method of the class: DataStore{}

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->add_sql_query_params( $query_args );
$query_args(array) (required)
Query arguments supplied by the user.

Code of DataStore::add_sql_query_params() WC 5.2.2

<?php
protected function add_sql_query_params( $query_args ) {
	global $wpdb;
	$order_product_lookup_table = self::get_db_table_name();

	$this->add_time_period_sql_params( $query_args, $order_product_lookup_table );

	// join wp_order_product_lookup_table with relationships and taxonomies
	// @todo How to handle custom product tables?
	$this->subquery->add_sql_clause( 'left_join', "LEFT JOIN {$wpdb->term_relationships} ON {$order_product_lookup_table}.product_id = {$wpdb->term_relationships}.object_id" );
	// Adding this (inner) JOIN as a LEFT JOIN for ordering purposes. See comment in add_order_by_params().
	$this->subquery->add_sql_clause( 'left_join', "JOIN {$wpdb->term_taxonomy} ON {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id" );
	$this->subquery->add_sql_clause( 'left_join', "LEFT JOIN {$wpdb->wc_category_lookup} ON {$wpdb->term_taxonomy}.term_id = {$wpdb->wc_category_lookup}.category_id" );

	$included_categories = $this->get_included_categories( $query_args );
	if ( $included_categories ) {
		$this->subquery->add_sql_clause( 'where', "AND {$wpdb->wc_category_lookup}.category_tree_id IN ({$included_categories})" );

		// Limit is left out here so that the grouping in code by PHP can be applied correctly.
		// This also needs to be put after the term_taxonomy JOIN so that we can match the correct term name.
		$this->add_order_by_params( $query_args, 'outer', 'default_results.category_id' );
	} else {
		$this->add_order_by_params( $query_args, 'inner', "{$wpdb->wc_category_lookup}.category_tree_id" );
	}

	$this->add_order_status_clause( $query_args, $order_product_lookup_table, $this->subquery );
	$this->subquery->add_sql_clause( 'where', "AND {$wpdb->wc_category_lookup}.category_tree_id IS NOT NULL" );
}