src/traits/class-translate.php
private function translateSelect() { // @codingStandardsIgnoreLine
		$build = array( 'select' );

		if ( $this->found_rows ) {
			$build[] = 'SQL_CALC_FOUND_ROWS';
		}
		if ( $this->distinct ) {
			$build[] = 'distinct';
		}

		// Build the selected fields.
		$build[] = ! empty( $this->statements['select'] ) && is_array( $this->statements['select'] ) ? join( ', ', $this->statements['select'] ) : '*';

		// Append the table.
		$build[] = 'from ' . $this->table;

		// Build the where statements.
		if ( ! empty( $this->statements['wheres'] ) ) {
			$build[] = join( ' ', $this->statements['wheres'] );
		}

		// Build the group by statements.
		if ( ! empty( $this->statements['groups'] ) ) {
			$build[] = 'group by ' . join( ', ', $this->statements['groups'] );

			if ( ! empty( $this->statements['having'] ) ) {
				$build[] = $this->statements['having'];
			}
		}

		// Build the order statement.
		if ( ! empty( $this->statements['orders'] ) ) {
			$build[] = $this->translateOrderBy();
		}

		// Build offset and limit.
		if ( ! empty( $this->limit ) ) {
			$build[] = $this->limit;
		}

		return join( ' ', $build );
	}
private function translateSelect() { // @codingStandardsIgnoreLine
		$build = array( 'select' );

		if ( $this->found_rows ) {
			$build[] = 'SQL_CALC_FOUND_ROWS';
		}
		if ( $this->distinct ) {
			$build[] = 'distinct';
		}

		// Build the selected fields.
		$build[] = ! empty( $this->statements['select'] ) && is_array( $this->statements['select'] ) ? join( ', ', $this->statements['select'] ) : '*';

		// Append the table.
		$build[] = 'from ' . $this->table;

		// Build the where statements.
		if ( ! empty( $this->statements['wheres'] ) ) {
			$build[] = join( ' ', $this->statements['wheres'] );
		}

		// Build the group by statements.
		if ( ! empty( $this->statements['groups'] ) ) {
			$build[] = 'group by ' . join( ', ', $this->statements['groups'] );

			if ( ! empty( $this->statements['having'] ) ) {
				$build[] = $this->statements['having'];
			}
		}

		// Build the order statement.
		if ( ! empty( $this->statements['orders'] ) ) {
			$build[] = $this->translateOrderBy();
		}

		// Build offset and limit.
		if ( ! empty( $this->limit ) ) {
			$build[] = $this->limit;
		}

		return join( ' ', $build );
	}
Translate the current query to an SQL select statement

@return string