MySQL: Grouping with condition
Thanks for the clear specifications of the requirements, and the sample input and output.

"Each person must have at least 1 item." -- probably no extra code.

"Each person can have 0 or 1 active items only." -- GROUP BY person_id, then do the test in HAVING SUM(is_active = 'YES') &lt;= 1.

"Get 1 record only for each person" -- The GROUP BY does that.

"Get the row with is_active = "YES" if person has an active item. If person doesn't have any active item, get 1 record (any record) of that person." -- This gets tricky.  If there were only one person, something like this should work: ORDER BY is_active = 'YES' DESC  LIMIT 1.  But that does not work with grouping.  More in a minute.

"Order result by person id DESC" -- This happens at the end.

Now it gets tricky because you need a "groupwise max".  Let's try to get the item.id values rather than just the one id desired.  Then work on getting the details for the 'first' id.  And let's wait until the end to get the person.name; we can easily ignore it until then.

SELECT  id,
        GROUP_CONCAT(id ORDER BY is_active = 'YES' DESC) AS ids
    FROM  items
    GROUP BY  id
    HAVING  SUM(is_active = 'YES') &lt;= 1
    ORDER BY id DESC


See if that gives you the correct set of rows (1 per person, ordered correctly) and the first id of ids is the desired item.  Assuming all that works, let's finish by getting the other desired columns.  (I will eliminate the redundant column in your sample output, and toss the ids.)

SELECT  p.id,
        p.name,
        IF(i.is_active = 'YES', i.name, '') AS item_name
    FROM (
            the-above-select
         ) AS x
    JOIN items AS i  ON i.id = SUBSTRING_INDEX(x.ids, ',', 1)
    JOIN persons AS p ON p.id = x.id
    ORDER BY p.id DESC


(There is, of course, a chance that I goofed.  But that could come close.)