SELECT * FROM categories c WHERE 1=1 AND parentId = 0 AND ((SELECT count(*) FROM videos v where v.categories_id = c.id OR categories_id IN (SELECT id from categories where parentId = c.id)) > 0 OR ( SELECT count(*) FROM live_transmitions lt where (lt.categories_id = c.id OR lt.categories_id IN (SELECT id from categories where parentId = c.id)) ) > 0 OR ( SELECT count(*) FROM LiveLinks ll where (ll.categories_id = c.id OR ll.categories_id IN (SELECT id from categories where parentId = c.id)) ) > 0 ) ORDER BY `order`, name ASC LIMIT 0, 1000 \nError : (1146) Table 'adbVideo.live_transmitions' doesn't exist