Automattic\WooCommerce\Admin\API\Reports
SqlQuery::get_query_statement()
Get the full SQL statement.
Method of the class: SqlQuery{}
No Hooks.
Return
String
.
Usage
$SqlQuery = new SqlQuery(); $SqlQuery->get_query_statement();
SqlQuery::get_query_statement() SqlQuery::get query statement code WC 9.6.0
public function get_query_statement() { $join = $this->get_sql_clause( 'join', 'filtered' ); $where = $this->get_sql_clause( 'where', 'filtered' ); $group_by = $this->get_sql_clause( 'group_by', 'filtered' ); $having = $this->get_sql_clause( 'having', 'filtered' ); $order_by = $this->get_sql_clause( 'order_by', 'filtered' ); $union = $this->get_sql_clause( 'union', 'filtered' ); $statement = ''; $statement .= " SELECT {$this->get_sql_clause( 'select', 'filtered' )} FROM {$this->get_sql_clause( 'from', 'filtered' )} {$join} WHERE 1=1 {$where} "; if ( ! empty( $group_by ) ) { $statement .= " GROUP BY {$group_by} "; if ( ! empty( $having ) ) { $statement .= " HAVING 1=1 {$having} "; } } if ( ! empty( $union ) ) { $statement .= " UNION {$union} "; } if ( ! empty( $order_by ) ) { $statement .= " ORDER BY {$order_by} "; } return $statement . $this->get_sql_clause( 'limit', 'filtered' ); }