SELECT s.id, s.extra, ss.ref_seminarka FROM seminarka AS s LEFT JOIN seminarka_spisovatel AS ss ON s.id = ss.ref_seminarka WHERE s.id IN(4054, 7513, 8077, 8584, 12757, 15073, 15113, 15435, 15715, 15895, 16490, 18483, 19396, 19420, 22858, 23913, 24398, 24399, 24400, 24848, 24850, 24856, 26797, 26986, 27855, 28361, 28362, 28364, 28365, 28368, 28369, 28370, 28371, 28374, 28380, 28388, 28389, 28390, 28406, 28407, 28409, 28410, 28414, 28415, 28416, 28425, 28431, 28510, 28511, 28512, 28513, 28514, 28515, 28516, 28517, 28519, 28520, 28521, 28522, 28523, 28532, 28533, 28534, 28536, 28537, 28539, 28540, 28541, 28546, 28547, 28548, 28549, 28550, 28553, 28554, 28555, 28556, 28557, 28562, 28563, 28564, 28568, 28570, 28573, 28575, 28576, 28577, 28585, 28586, 28587, 28588, 28589, 28600, 28601, 28604, 28605, 28606, 28607, 28608, 28612, 28613, 28614, 28615, 28616, 28620, 28621, 28622, 28623, 28625, 28626, 28627, 28628, 28629, 28632, 28633, 28634, 28635, 28636, 28641, 28642, 28643, 28644, 28645, 28646, 28647, 28648, 28649, 28650, 28651, 28660, 28661, 28662, 28663, 28664, 28670, 28674, 28675, 28676, 28677, 28678, 28682, 28688, 28689, 28690, 28691, 28692, 28693, 28694, 28702, 28703, 28704, 28706, 28707, 28708, 28718, 28719, 28720, 28721, 28722, 28742, 28743, 28744, 28745, 28746, 28752, 28753, 28754, 28755, 28756, 28762, 28763, 28764, 28765, 28766, 28773, 28774, 28775, 28776, 28777, 28788, 28789, 28790, 28791, 28792, 28815, 28816, 28828, 28862, 28863, 28865, 28866, 28873, 28894, 28896, 28897, 28911, 28912, 28913, 28914, 28920, 28921, 28923, 28926, 28938, 28939, 28940, 28941, 28942, 28952, 28953, 28961, 28962, 28969, 28970, 28972, 28973, 28976, 28977, 28980, 28981, 28982, 28983, 28984, 28988, 28989, 28990, 28993, 28994, 28995, 28999, 29000, 29004, 29005, 29087, 29088, 29089, 29090, 29111, 29159, 29165, 29166, 29167, 29172, 29173, 29175, 29176, 29339, 29362, 29363, 29365, 29366, 29432, 29433, 29434, 29435, 29436, 29437, 29438, 29442, 29471, 29472, 29645, 29646, 29647, 29648, 29649, 29650, 29651, 29652, 29653, 29654, 29660, 29661, 29662, 29663, 29664, 29667, 29668, 29669, 29670, 29671, 29672, 29674, 29675, 29676, 29677, 29678, 29680, 29681, 29682, 29683, 29684, 29691, 29692, 29693, 29694, 29695, 29710, 29877, 29878, 30575, 30576, 30577, 30578, 30820, 30984, 30985, 30999, 31000, 31001, 31002, 31007, 31015, 31016, 31017, 31018, 31019, 31021, 32152, 32224, 32225, 32836) and s.autorizace >0 and s.id in (select distinct STR_SEMINARKA_FK from strom where STR_SEMINARKA_TYP_FK in (2, 4, 20) or (STR_SEMINARKA_TYP_FK=17 and STR_SUBKATEGORIE_FK=247) or (STR_SEMINARKA_TYP_FK in (18, 1, 9, 11) and STR_SUBKATEGORIE_FK in (117, 342))) GROUP BY s.id