SELECT TRIM(BOTH ', ' FROM 
    REPLACE(
        REPLACE(
            CONCAT(
                IF(d7.name IS NULL OR d7.name = d6.name OR d7.name = '', '', d7.name), 
                IF(d7.name IS NOT NULL AND d6.name IS NOT NULL AND d7.name != '' AND d6.name != '', ', ', ''),
                IF(d6.name IS NULL OR d6.name = d5.name OR d6.name = '', '', d6.name), 
                IF(d6.name IS NOT NULL AND d5.name IS NOT NULL AND d6.name != '' AND d5.name != '', ', ', ''),
                IF(d5.name IS NULL OR d5.name = d4.name OR d5.name = '', '', d5.name), 
                IF(d5.name IS NOT NULL AND d4.name IS NOT NULL AND d5.name != '' AND d4.name != '', ', ', ''),
                IF(d4.name IS NULL OR d4.name = d3.name OR d4.name = '', '', d4.name), 
                IF(d4.name IS NOT NULL AND d3.name IS NOT NULL AND d4.name != '' AND d3.name != '', ', ', ''),
                IF(d3.name IS NULL OR d3.name = d2.name OR d3.name = '', '', d3.name), 
                IF(d3.name IS NOT NULL AND d2.name IS NOT NULL AND d3.name != '' AND d2.name != '', ', ', ''),
                IF(d2.name IS NULL OR d2.name = d1.name OR d2.name = '', '', d2.name), 
                IF(d2.name IS NOT NULL AND d1.name IS NOT NULL AND d2.name != '' AND d1.name != '', ', ', ''),
                IFNULL(d1.name, '')
            ), ', ,', ','
        ), ', ,', ','
    )
) AS denis_full_address_name
FROM denis_full_address_name AS d1
RIGHT JOIN denis_address_name_copy AS d2 ON d1.id = d2.id_address_name
RIGHT JOIN denis_address_name_copy AS d3 ON d2.id = d3.id_address_name
RIGHT JOIN denis_address_name_copy AS d4 ON d3.id = d4.id_address_name
RIGHT JOIN denis_address_name_copy AS d5 ON d4.id = d5.id_address_name
RIGHT JOIN denis_address_name_copy AS d6 ON d5.id = d6.id_address_name
RIGHT JOIN denis_address_name_copy AS d7 ON d6.id = d7.id_address_name
ORDER BY denis_full_address_name;