Retrieve the post SQL based on capability, author, and type.

Signature

get_posts_by_author_sql( $post_type, $full = true, $post_author = null, $public_only = false )
post_type
 (array|string) Single post type or an array of post types.
full
 (boolean) Optional. Returns a full WHERE statement instead of just an 'andalso' term. Default true.
Default: true
post_author
 (int) Optional. Query posts having a single author ID. Default null.
Default: null
public_only
 (boolean) Optional. Only return public posts. Skips cap checks for $current_user. Default false.
Default: false

Return

(string) SQL WHERE code that can be added to a query.

Source

function get_posts_by_author_sql( $post_type, $full = true, $post_author = null, $public_only = false ) {
	global $wpdb;

	if ( is_array( $post_type ) ) {
		$post_types = $post_type;
	} else {
		$post_types = array( $post_type );
	}

	$post_type_clauses = array();
	foreach ( $post_types as $post_type ) {
		$post_type_obj = get_post_type_object( $post_type );
		if ( ! $post_type_obj ) {
			continue;
		}

		/**
		 * Filters the capability to read private posts for a custom post type
		 * when generating SQL for getting posts by author.
		 *
45 more lines...
WP Trac GitHub

Link here