No valid database connection Subquery returns more than 1 row SQL=SELECT DISTINCT relation.itemid, relation.catid, title, owner, image, background, icon, (SELECT data_txt FROM `jos_sobi2_fields_data` WHERE fieldid = 17 AND itemid = items.itemid) as tipoavanzado, (SELECT data_txt FROM `jos_sobi2_fields_data` WHERE fieldid = 18 AND itemid = items.itemid) as tipobase, (SELECT data_txt FROM `jos_sobi2_fields_data` WHERE fieldid = 19 AND itemid = items.itemid) as primeras FROM `jos_sobi2_cat_items_relations` AS relation LEFT JOIN `jos_sobi2_item` AS items ON relation.itemid = items.itemid WHERE ((`catid` = 163 OR `catid` = 163 OR `catid` = 3244 OR `catid` = 3299 OR `catid` = 3316 OR `catid` = 3357 OR `catid` = 3432 OR `catid` = 3472 OR `catid` = 3550 OR `catid` = 3631 OR `catid` = 3645 ) AND `published` = '1' AND (`publish_down` > '2012-05-23 17:37:21' OR `publish_down` = '0000-00-00 00:00:00' ) AND items.itemid IN(SELECT DISTINCT relation.itemid FROM `jos_sobi2_cat_items_relations` AS relation LEFT JOIN `jos_sobi2_item` AS items ON relation.itemid = items.itemid WHERE ((`catid` = 163 OR `catid` = 163 OR `catid` = 3244 OR `catid` = 3299 OR `catid` = 3316 OR `catid` = 3357 OR `catid` = 3432 OR `catid` = 3472 OR `catid` = 3550 OR `catid` = 3631 OR `catid` = 3645 ) AND `published` = 1 AND (`publish_down` > '2012-05-23 17:37:21' OR `publish_down` = '0000-00-00 00:00:00' ) )) ) GROUP BY items.itemid ORDER BY tipoavanzado DESC, tipobase DESC, primeras DESC, items.title ASC LIMIT 0, 15