SELECT art.Id_Articolo AS ps3,
art.Id_Argomento as ps2,
art.Id_MediaType AS ps1,
DataCompleta,
IF(TRIM(COALESCE(TitoloHomeit, '')) = '', Titoloit, TitoloHomeit) AS Titolo,
IF(TRIM(COALESCE(FotoHome, '')) = '', CONCAT('https://www.biobank.it/fotovecchie', exFoto1), FotoHome) AS FotoHome,
DenomArgomit AS Argomento,
IF(TRIM(COALESCE(Colore, '')) ='', 'a59989', Colore) AS Colore,
exLetture,
(SELECT LinkPath FROM res_blog LEFT JOIN ana_risorse ON res_blog.Id_Risorsa=ana_risorse.Id_Risorsa LEFT JOIN blog_articoli ON res_blog.Id_Blog=blog_articoli.Id_Articolo WHERE res_blog.ps1 = art.Id_MediaType AND Id_Blog = art.Id_Articolo) AS LinkPath
FROM blog_articoli art
LEFT JOIN blog_argomenti ON art.Id_Argomento=blog_argomenti.Id_Argomento
LEFT JOIN (blog_media_types
LEFT JOIN bb_symbols ON blog_media_types.Id_BBSymbol=bb_symbols.Id_Symbol)
ON art.Id_MediaType = blog_media_types.Id_MediaType
WHERE FlagVisibile UNION (
SELECT art.Id_Media AS ps3,
art.Id_Argomento AS ps2,
art.Id_MediaType AS ps1,
DataCompleta,
IF(TRIM(COALESCE(TitoloHomeit, '')) = '', Titoloit, TitoloHomeit) AS Titolo,
FotoHome,
DenomArgomit AS Argomento,
IF(TRIM(COALESCE(Colore, '')) = '', 'a59989', Colore) AS Colore,
exLetture,
(SELECT LinkPath FROM res_blog LEFT JOIN ana_risorse ON res_blog.Id_Risorsa=ana_risorse.Id_Risorsa LEFT JOIN blog_articoli ON res_blog.Id_Blog=blog_articoli.Id_Articolo WHERE res_blog.ps1 = art.Id_MediaType AND Id_Blog = art.Id_Media) AS LinkPath
FROM blog_media art
LEFT JOIN blog_argomenti ON art.Id_Argomento=blog_argomenti.Id_Argomento
LEFT JOIN (blog_media_types
LEFT JOIN bb_symbols ON blog_media_types.Id_BBSymbol=bb_symbols.Id_Symbol)
ON art.Id_MediaType = blog_media_types.Id_MediaType
WHERE FlagVisibile) ORDER BY DataCompleta DESC LIMIT 0,6