$sql='SELECT i.id AS i__id, i.name AS i__name, i2.id AS i2__id, i2.username AS i2__username FROM inheritance_deal i LEFT JOIN inheritance_entity_user i3 ON i.id = i3.entity_id LEFT JOIN inheritance_user i2 ON i2.id = i3.user_id WHERE i2.id = 1 AND (i3.type = 1 OR i3.type IS NULL)';