Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableDataStore::get_order_table_select_statement()privateWC 1.0

Helper method to generate combined select statement.

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

No Hooks.

Return

String. Select SQL statement to fetch order.

Usage

// private - for code of main (parent) class only
$result = $this->get_order_table_select_statement();

Code of OrdersTableDataStore::get_order_table_select_statement() WC 6.6.1

private function get_order_table_select_statement() {
	$order_table                  = $this::get_orders_table_name();
	$order_table_alias            = 'wc_order';
	$select_clause                = $this->generate_select_clause_for_props( $order_table_alias, $this->order_column_mapping );
	$billing_address_table_alias  = 'address_billing';
	$shipping_address_table_alias = 'address_shipping';
	$op_data_table_alias          = 'order_operational_data';
	$billing_address_clauses      = $this->join_billing_address_table_to_order_query( $order_table_alias, $billing_address_table_alias );
	$shipping_address_clauses     = $this->join_shipping_address_table_to_order_query( $order_table_alias, $shipping_address_table_alias );
	$operational_data_clauses     = $this->join_operational_data_table_to_order_query( $order_table_alias, $op_data_table_alias );

	return "
SELECT $select_clause, {$billing_address_clauses['select']}, {$shipping_address_clauses['select']}, {$operational_data_clauses['select']}
FROM $order_table $order_table_alias
LEFT JOIN {$billing_address_clauses['join']}
LEFT JOIN {$shipping_address_clauses['join']}
LEFT JOIN {$operational_data_clauses['join']}
";
}