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(355, 524, 843, 919, 930, 931, 1096, 1218, 1219, 1246, 1247, 1251, 1252, 1264, 1266, 1267, 1269, 1271, 1773, 1774, 1775, 1776, 1777, 1778, 1884, 1938, 2316, 2449, 2817, 3339, 3434, 3452, 3523, 3524, 3525, 3665, 3794, 3968, 4357, 4358, 4360, 4361, 4552, 4881, 4923, 4961, 5194, 5196, 5257, 5258, 5259, 5260, 5261, 5558, 5791, 5957, 6015, 6016, 6035, 6037, 6038, 6049, 6051, 6053, 6213, 6268, 6991, 7180, 7345, 7456, 7590, 7689, 8048, 8415, 8433, 8483, 8824, 8898, 9135, 9263, 9264, 9265, 9415, 9457, 9605, 9666, 9865, 10438, 10544, 12521, 12581, 12874, 12875, 12876, 12945, 13105, 13244, 13436, 13479, 13490, 13545, 14118, 14464, 14501, 15013, 15234, 15292, 15491, 15494, 15495, 15509, 15610, 15687, 15699, 15782, 16007, 16400, 16404, 16444, 16445, 16446, 16447, 16836, 16943, 17114, 17282, 17284, 17623, 17999, 18431, 18554, 18555, 18558, 18899, 18945, 18979, 19229, 19230, 19231, 19232, 20341, 20541, 20637, 20754, 20988, 21304, 21344, 21393, 21569, 21580, 21582, 21708, 21709, 21759, 21760, 21761, 21762, 22100, 22393, 22574, 22757, 22777, 23014, 23015, 23016, 23017, 23018, 23034, 23035, 23036, 23037, 23038, 23063, 23064, 23065, 23066, 23075, 23207, 23443, 23945, 24231, 24239, 24288, 24509, 24881, 24908, 25058, 25398, 25514, 25530, 25898, 25930, 25960, 26256, 26257, 26302, 26303, 26304, 26305, 26306, 26323, 26324, 26325, 26326, 26492, 26569, 26586, 26588, 26684, 26917, 27054, 27082, 27419, 27420, 27421, 27425, 27426, 27466, 27467, 27483, 27484, 27485, 28312, 28325, 29181, 29553, 29554, 30238, 30279, 30644, 30669, 30670, 30671, 30746, 30851, 30964, 31161, 31280, 31281, 31349, 31740, 31741, 31852, 31876, 31877, 31878, 31880, 31881, 32087, 32095, 32096, 32115, 32116, 32117, 32118, 32128, 32129, 32130, 32496, 33080, 33081, 33289, 33291, 33292, 33293, 33294, 33295, 33296, 33297, 33298, 33299, 33300, 33310, 33640, 33641) 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