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(20, 34, 322, 452, 603, 606, 714, 789, 799, 822, 849, 1028, 1029, 1056, 1097, 1105, 1106, 1651, 1652, 1653, 1655, 1656, 1658, 1659, 1660, 1661, 1662, 1728, 1762, 1763, 1857, 2120, 2121, 2123, 2538, 2633, 2922, 2923, 3066, 3067, 3114, 3123, 3128, 3190, 3204, 3206, 3207, 3208, 3209, 3289, 3292, 3499, 3511, 3582, 3599, 3675, 3681, 3696, 3807, 3808, 3851, 3868, 4026, 4027, 4028, 4029, 4077, 4116, 4143, 4144, 4145, 4146, 4147, 4236, 4237, 4261, 4272, 4273, 4274, 4295, 4296, 4363, 4364, 4375, 4408, 4419, 4624, 4693, 4714, 4745, 4748, 4749, 4857, 4926, 5071, 5119, 5141, 5171, 5173, 5205, 5206, 5207, 5211, 5221, 5263, 5265, 5291, 5319, 5320, 5322, 5326, 5327, 5358, 5400, 5693, 5695, 5708, 5864, 5872, 5885, 5895, 5925, 5959, 5960, 6007, 6205, 6371, 6454, 6566, 6788, 6809, 6987, 7210, 7215, 7293, 7400, 7401, 7402, 7559, 7867, 7869, 7948, 7967, 7985, 8045, 8058, 8059, 8090, 8111, 8132, 8133, 8187, 8191, 8254, 8304, 8514, 8515, 8571, 8804, 8821, 8887, 8890, 8972, 9094, 9095, 9140, 9232, 9509, 9559, 9614, 9625, 9629, 9630, 9631, 9633, 9637, 9645, 9656, 9779, 9790, 9808, 9909, 9953, 9957, 9958, 9959, 9960, 9961, 10004, 10058, 10102, 10182, 10203, 10204, 10282, 10380, 10384, 10385, 10386, 10387, 10390, 10391, 10395, 10592, 10687, 10813, 10822, 10866, 10869, 10871, 11000, 11028, 11030, 11044, 11163, 11202, 11277, 11419, 11593, 11710, 11711, 11746, 11761, 11788, 11825, 11832, 11987, 11990, 11991, 12021, 12037, 12049, 12072, 12090, 12115, 12125, 12152, 12173, 12306, 12451, 12488, 12522, 12645, 12701, 12772, 12890, 12975, 13087, 13091, 13093, 13150, 13174, 13261, 13331, 13378, 13399, 13411, 13431, 13515, 13569, 13583, 13662, 13850, 13889, 13983, 14010, 14011, 14059, 14069, 14101, 14221, 14238, 14243, 14278, 14308, 14324, 14326, 14332, 14334, 14353, 14449, 14492, 14553, 14556, 14563, 14608, 14609, 14699, 14779, 14840, 15034, 15046, 15074, 15097, 15137, 15302, 15471, 15473, 15474, 15475, 15570, 15602, 15626, 15668, 15695, 15703, 15717, 15726, 15739, 15815, 15819, 15887, 16029, 16065, 16077, 16282, 16405, 16453, 16613, 16615, 16641, 16740, 16741, 16742, 16780, 16783, 16784, 16785, 16786, 16826, 16835, 16881, 16934, 16936, 17012, 17062, 17069, 17108, 17109, 17113, 17139, 17168, 17173, 17186, 17219, 17228, 17251, 17252, 17309, 17312, 17353, 17534, 17535, 17591, 17601, 17726, 17727, 17876, 17949, 18068, 18081, 18082, 18083, 18134, 18143, 18158, 18245, 18246, 18252, 18253, 18290, 18371, 18383, 18409, 18424, 18457, 18544, 18634, 18651, 18666, 18697, 18700, 18761, 18847, 18875, 18912, 18931, 18937, 18938, 18952, 18954, 18972, 18973, 18988, 19008, 19009, 19010, 19012, 19025, 19078, 19162, 19163, 19209, 19258, 19351, 19367, 19430, 19491, 19527, 19545, 19633, 19645, 19831, 19856, 19877, 20050, 20051, 20058, 20080, 20133, 20136, 20218, 20229, 20257, 20324, 20419, 20445, 20446, 20491, 20533, 20604, 20638, 20639, 20669, 20670, 20684, 20691, 20693, 20703, 20704, 20706, 20764, 20775, 20822, 20879, 20883, 20884, 20885, 20946, 20948, 20949, 20961, 20965, 21012, 21013, 21029, 21031, 21142, 21143, 21144, 21145, 21146, 21275, 21276, 21277, 21280, 21281, 21290, 21301, 21302, 21316, 21350, 21359, 21361, 21409, 21410, 21435, 21468, 21469, 21470, 21471, 21485, 21487, 21522, 21542, 21543, 21561, 21607, 21624, 21851, 21876, 21890, 21921, 21925, 21953, 21960, 21972, 21973, 21997, 22125, 22132, 22175, 22210, 22394, 22395, 22422, 22471, 22547, 22548, 22553, 22598, 22659, 22660, 22661, 22662, 22691, 22888, 22906, 22907, 22952, 22962, 22963, 22964, 23006, 23019, 23029, 23030, 23093, 23122, 23160, 23190, 23205, 23258, 23260, 23281, 23449, 23455, 23670, 23672, 23676, 23710, 23740, 23800, 23801, 23815, 23831, 23872, 23873, 23874, 24032, 24037, 24061, 24229, 24267, 24375, 24387, 24388, 24390, 24406, 24477, 24555, 24580, 24753, 24984, 25011, 25141, 25281, 25284, 25304, 25345, 25350, 25435, 25471, 25645, 25658, 25749, 25752, 25754, 25761, 25764, 25904, 25906, 25912, 25913, 25914, 25915, 25924, 25925, 25926, 25927, 25928, 25934, 25937, 25942, 25944, 25951, 25952, 25966, 25967, 25980, 25982, 25988, 25990, 25991, 25992, 25995, 25996, 26006, 26011, 26012, 26013, 26014, 26015, 26021, 26023, 26024, 26025, 26026, 26027, 26029, 26030, 26090, 26094, 26184, 26185, 26186, 26187, 26217, 26336, 26343, 26344, 26351, 26353, 26399, 26496, 26498, 26585, 26594, 26620, 26652, 26987, 26991, 26994, 27006, 27034, 27035, 27178, 27192, 27193, 27195, 27196, 27199, 27333, 27335, 27377, 27378, 27379, 27385, 27386, 27390, 27391, 27442, 27444, 27447, 27448, 27449, 27450, 27452, 27489, 27499, 27781, 27941, 28027, 28043, 28049, 28051, 28052, 28088, 28089, 28171, 28236, 28333, 28349, 28411, 28412, 28652, 28653, 28654, 28884, 28885, 28886, 28888, 28889, 29059, 29060, 29061, 29081, 29082, 29638, 29639, 30008, 30027, 30028, 30030, 30096, 30097, 30098, 30357, 30365, 30397, 30398, 30399, 30401, 30402, 30405, 30418, 30494, 30627, 30628, 30629, 30682, 30683, 30710, 30722, 30725, 30726, 30753, 30813, 30814, 30992, 30993, 30994, 30996, 31009, 31089, 31230, 31238, 31639, 31737, 31764, 31765, 31767, 31768, 31769, 31771, 31774, 31777, 31778, 31779, 31780, 31781, 31782, 31783, 31784, 31789, 31793, 31796, 31797, 31798, 31801, 31802, 31803, 31804, 31805, 31806, 31871, 31949, 31991, 32274, 32318, 32325, 32327, 32334, 32396, 32397, 32398, 32399, 32400, 32401, 32402, 32403, 32405, 32406, 32407, 32408, 32409, 32410, 32606, 32610, 32611, 32754, 32756, 32770, 33588, 33589, 33591) 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