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(12, 24, 25, 38, 156, 165, 166, 167, 169, 178, 252, 271, 286, 333, 334, 335, 384, 474, 518, 528, 542, 577, 604, 665, 690, 694, 749, 802, 808, 826, 838, 846, 862, 873, 878, 947, 1111, 1481, 1668, 1715, 1717, 1718, 1719, 1720, 1731, 1865, 1869, 1870, 1875, 1876, 1877, 1902, 1903, 1915, 1929, 1963, 1964, 1965, 1966, 1967, 1981, 1992, 2124, 2125, 2126, 2127, 2128, 2130, 2131, 2321, 2348, 2393, 2397, 2442, 2462, 2505, 2851, 3057, 3089, 3090, 3091, 3092, 3093, 3094, 3095, 3096, 3097, 3098, 3099, 3100, 3101, 3102, 3103, 3104, 3105, 3111, 3117, 3204, 3205, 3222, 3229, 3244, 3249, 3309, 3316, 3317, 3319, 3346, 3354, 3360, 3401, 3445, 3473, 3489, 3508, 3514, 3536, 3542, 3576, 3579, 3591, 3607, 3618, 3619, 3637, 3660, 3661, 3707, 3712, 3713, 3714, 3733, 3734, 3735, 3740, 3741, 3742, 3801, 3802, 3803, 3804, 3805, 3941, 4003, 4153, 4154, 4287, 4328, 4330, 4331, 4384, 4387, 4389, 4390, 4398, 4399, 4422, 4453, 4454, 4455, 4489, 4516, 4517, 4520, 4528, 4599, 4606, 4638, 4658, 4659, 4660, 4662, 4684, 4685, 4731, 4751, 4772, 4773, 4776, 4813, 4814, 4817, 4845, 4889, 4958, 4959, 4986, 4987, 5134, 5155, 5163, 5164, 5166, 5167, 5169, 5200, 5201, 5202, 5305, 5340, 5342, 5343, 5378, 5379, 5380, 5395, 5414, 5418, 5446, 5447, 5448, 5472, 5562, 5564, 5565, 5566, 5574, 5577, 5578, 5579, 5580, 5581, 5585, 5623, 5640, 5643, 5719, 5817, 5818, 5819, 5820, 5825, 5826, 5827, 5828, 5849, 5852, 5854, 5856, 5907, 5908, 5976, 5977, 5978, 6010, 6148, 6151, 6208, 6209, 6210, 6211, 6266, 6313, 6330, 6331, 6407, 6529, 6557, 6582, 6583, 6584, 6585, 6586, 6635, 6636, 6790, 6831, 6887, 6923, 7002, 7050, 7095, 7118, 7136, 7140, 7178, 7217, 7233, 7351, 7393, 7394, 7395, 7417, 7428, 7463, 7464, 7494, 7499, 7534, 7578, 7581, 7602, 7603, 7626, 7628, 7793, 7872, 7890, 7897, 7899, 7904, 7929, 8026, 8051, 8097, 8118, 8125, 8167, 8168, 8199, 8436, 8513, 8586, 8611, 8612, 8638, 8657, 8660, 8693, 8695, 8734, 8766, 8767, 8768, 8771, 8775, 8776, 8793, 8795, 8991, 8993, 8994, 9002, 9060, 9061, 9093, 9287, 9340, 9344, 9416, 9427, 9476, 9572, 9590, 9596, 9602, 9603, 9624, 9642, 9689, 9694, 9711, 9754, 9828, 9842, 9875, 9943, 9998, 10068, 10081, 10082, 10084, 10104, 10105, 10142, 10235, 10332, 10393, 10400, 10420, 10475, 10495, 10514, 10528, 10535, 10537, 10538, 10539, 10540, 10550, 10557, 10565, 10566, 10574, 10581, 10620, 10668, 10733, 10754, 10755, 10823, 10836, 10861, 10894, 10950, 11021, 11029, 11042, 11043, 11054, 11055, 11149, 11150, 11151, 11192, 11231, 11236, 11237, 11238, 11267, 11293, 11332, 11415, 11453, 11454, 11455, 11456, 11487, 11495, 11496, 11497, 11498, 11517, 11529, 11541, 11542, 11543, 11544, 11545, 11550, 11551, 11552, 11553, 11554, 11568, 11580, 11602, 11632, 11660, 11661, 11670, 11671, 11880, 11892, 11906, 11936, 12006, 12060, 12066, 12075, 12130, 12291, 12316, 12317, 12329, 12405, 12406, 12436, 12440, 12441, 12461, 12544, 12571, 12619, 12673, 12798, 12814, 12815, 12825, 12856, 12887, 12914, 12915, 12916, 12956, 12957, 12993, 12994, 12995, 12996, 13008, 13053, 13064, 13098, 13099, 13100, 13101, 13102, 13116, 13220, 13265, 13328, 13361, 13362, 13543, 13596, 13597, 13624, 13625, 13793, 13794, 13844, 13872, 13941, 13998, 14071, 14117, 14154, 14155, 14281, 14327, 14373, 14374, 14470, 14476, 14485, 14486, 14519, 14524, 14557, 14572, 14612, 14622, 14645, 14649, 14650, 14667, 14718, 14750, 14764, 14773, 14793, 14794, 14795, 14797, 14798, 14800, 14801, 14807, 14867, 14871, 14878, 14906, 15124, 15125, 15136, 15140, 15146, 15152, 15172, 15173, 15189, 15216, 15217, 15236, 15253, 15348, 15349, 15350, 15360, 15373, 15400, 15425, 15461, 15485, 15560, 15583, 15635, 15637, 15647, 15648, 15674, 15781, 15805, 15818, 15845, 15909, 15911, 15916, 15920, 15921, 15924, 15981, 15984, 15986, 15988, 15989, 15990, 15991, 15992, 16006, 16061, 16062, 16094, 16100, 16102, 16183, 16367, 16431, 16432, 16450, 16451, 16456, 16558, 16562, 16682, 16683, 16684, 16685, 16686, 16705, 16706, 16720, 16723, 16724, 16725, 16726, 16762, 16770, 16771, 16773, 16775, 16776, 16811, 16828, 16829, 16830, 16831, 16833, 16843, 16844, 16868, 16883, 16896, 16915, 16921, 16973, 17128, 17129, 17130, 17131, 17136, 17159, 17161, 17162, 17163, 17172, 17202, 17203, 17204, 17231, 17232, 17233, 17234, 17235, 17262, 17264, 17354, 17379, 17466, 17504, 17512, 17712, 17858, 17907, 17912, 17938, 17946, 17993, 18029, 18045, 18048, 18065, 18073, 18077, 18099, 18113, 18117, 18120, 18121, 18154, 18155, 18156, 18157, 18164, 18167, 18182, 18224, 18237, 18238, 18260, 18303, 18311, 18312, 18332, 18335, 18336, 18348, 18436, 18438, 18439, 18440, 18472, 18482, 18571, 18572, 18573, 18574, 18575, 18576, 18577, 18601, 18603, 18604, 18605, 18664, 18683, 18689, 18690, 18691, 18692, 18693, 18704, 18765, 18790, 18829, 18830, 18831, 18832, 18833, 18869, 18870, 18871, 18872, 18873, 18874, 18900, 18916, 18921, 18923, 18924, 18925, 18981, 18982, 19023, 19124, 19147, 19368, 19416, 19417, 19421, 19423, 19424, 19425, 19439, 19442, 19469, 19480, 19481, 19485, 19486, 19489, 19494, 19509, 19536, 19543, 19544, 19572, 19573, 19580, 19593, 19595, 19596, 19638, 19666, 19681, 19713, 19721, 19722, 19723, 19726, 19737, 19758, 19759, 19770, 19791, 19846, 19916, 19919, 20092, 20108, 20123, 20155, 20180, 20212, 20266, 20276, 20277, 20326, 20337, 20351, 20382, 20426, 20430, 20484, 20556, 20571, 20614, 20622, 20623, 20624, 20625, 20626, 20654, 20662, 20685, 20691, 20766, 20767, 20769, 20786, 20810, 20820, 20839, 20880, 20920, 20936, 20937, 20991, 20992, 20998, 21026, 21027, 21033, 21071, 21141, 21162, 21164, 21191, 21218, 21219, 21220, 21283, 21349, 21428, 21429, 21430, 21457, 21479, 21492, 21521, 21524, 21550, 21581, 21587, 21603, 21604, 21605, 21606, 21638, 21639, 21644, 21769, 21779, 21785, 21901, 21904, 21907, 21945, 22093, 22103, 22113, 22163, 22200, 22203, 22206, 22215, 22247, 22252, 22291, 22292, 22360, 22363, 22373, 22389, 22391, 22416, 22417, 22420, 22421, 22423, 22432, 22441, 22442, 22443, 22453, 22475, 22479, 22535, 22544, 22600, 22602, 22612, 22734, 22739, 22741, 22742, 22816, 22821, 22844, 22845, 22846, 22847, 22861, 22865, 22870, 22873, 22957, 22973, 23013, 23062, 23067, 23105, 23117, 23148, 23149, 23210, 23211, 23257, 23259, 23266, 23281, 23415, 23418, 23438, 23480, 23757, 23760, 23766, 23786, 23839, 23951, 24223, 24244, 24285, 24286, 24287, 24336, 24353, 24437, 24440, 24475, 24576, 24708, 24871, 24992, 25029, 25044, 25251, 25257, 25260, 25293, 25294, 25295, 25296, 25551, 25552, 25562, 25650, 25651, 25652, 25744, 25883, 25903, 26028, 26124, 26237, 26250, 26276, 26277, 26278, 26360, 26374, 26501, 26640, 27057, 27488, 27847, 27910, 28000, 28011, 28012, 28081, 28083, 28131, 28211, 28733, 28987, 29028, 29313, 29342, 29343, 29344, 29345, 29352, 29353, 29354, 29401, 29402, 29454, 29767, 29815, 29817, 29818, 29931, 30054, 30434, 30436, 30495, 30812, 30900, 31048, 31049, 31071, 31133, 31174, 31221, 31241, 31309, 31489, 31490, 31491, 31492, 31495, 31518, 31520, 31525, 31529, 31540, 31587, 31598, 31599, 31604, 31610, 31768, 31769, 31771, 31773, 31774, 31777, 31778, 31780, 31782, 31796, 31797, 31798, 31801, 31802, 31804, 31805, 31806, 31848, 31849, 31850, 31851, 33473) 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