select c.id,c.titolo as marca,g.gruppo,case when c.id=88 then 1 else 0 end as selected from ( select distinct id_marca from articoli where disponibilita>0 and CHARINDEX(',48,', ',' + ISNULL(GruppiIN,'') + ',') > 0) a join marche c on a.id_marca=c.id join gruppi g on g.id_gruppo=48|||||