SELECT 
    id as IdTablero,
    login_admintablero as '<i class="fa fa-key fa-fw"></i> Generado por',
    CONCAT("<b>",titulo,"</b>") as 'T&iacute;tulo',
    CONCAT("<font color=orange size=1>",
        REPEAT('█', ROUND((IFNULL(ROUND(((SELECT COUNT(*) FROM core_kanban WHERE tablero=IdTablero AND archivado=1)*100)/(SELECT COUNT(*) FROM core_kanban WHERE tablero=IdTablero AND categoria<>'[PRACTICO][ColumnasTablero]' AND categoria<>'[PRACTICO][CategoriasTareas]')),0))/2+1) ),
        "</font>",
        IFNULL(ROUND(((SELECT COUNT(*) FROM core_kanban WHERE tablero=IdTablero AND archivado=1)*100)/(SELECT COUNT(*) FROM core_kanban WHERE tablero=IdTablero AND categoria<>'[PRACTICO][ColumnasTablero]' AND categoria<>'[PRACTICO][CategoriasTareas]')),0)
        ,"%"
    ) as 'Finalizado',
    (SELECT COUNT(*) FROM core_kanban WHERE tablero=IdTablero AND categoria<>'[PRACTICO][ColumnasTablero]' AND categoria<>'[PRACTICO][CategoriasTareas]') as 'Tareas',
    (SELECT COUNT(*) FROM core_kanban WHERE tablero=IdTablero AND archivado=1) as 'Tareas archivadas',


    (SELECT COUNT(*) FROM core_kanban WHERE tablero=IdTablero AND categoria<>'[PRACTICO][ColumnasTablero]' AND categoria<>'[PRACTICO][CategoriasTareas]') -
    (SELECT COUNT(*) FROM core_kanban WHERE tablero=IdTablero AND archivado=1) as 'Activas',



    REPLACE(compartido_rw, "|", "<br>") as '<i class="fa fa-users fa-fw"></i> Compartir con'
FROM core_kanban
WHERE
    archivado<>1 AND 
    categoria='[PRACTICO][ColumnasTablero]' AND 
    (login_admintablero='rafael' OR compartido_rw LIKE '%|rafael|%')

ORDER BY titulo ASC