select i.idpagina,
                       i.idpaginapadre,
                       if(ifnull(trad.titolo, '') = '', i.titolo, trad.titolo) as titolo,
                       if(ifnull(trad.descrizione, '') = '', i.descrizione, trad.descrizione) as descrizione,
                       i.ordine,
                       i.immagine,
                       i.immagine2,
                       i.immagine3,
                       i.immagine4,
                       if(ifnull(trad.titolo_img, '') = '', i.titolo_img, trad.titolo_img) as titolo_img,
                       if(ifnull(trad.titolo_img2, '') = '', i.titolo_img2, trad.titolo_img2) as titolo_img2,
                       if(ifnull(trad.titolo_img3, '') = '', i.titolo_img3, trad.titolo_img3) as titolo_img3,
                       if(ifnull(trad.titolo_img4, '') = '', i.titolo_img4, trad.titolo_img4) as titolo_img4,
                       if(ifnull(trad.html, '') = '', i.html, trad.html) as html,
                       i.seopage,
                       0 as livello,
                       i.seoname
                       ,(select count(*) from siti_menu_pagine ii where ii.idpaginapadre = i.idpagina) as nrsons
                from siti_menu_pagine i
                left outer join siti_menu_pagine_trad trad on trad.idpagina = i.idpagina
                                                           and trad.codiceiso = 'it'
                where i.idsito = 56
                and i.idcompany = 105095
                and i.inmenu = 1
                and i.idpaginapadre = img
                order by i.ordine