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(510, 674, 853, 917, 1171, 1175, 1213, 2163, 2645, 2664, 3053, 3179, 3180, 3265, 3284, 3285, 3286, 3300, 3483, 3709, 4304, 4334, 4359, 4507, 4508, 4509, 4510, 4530, 4531, 4561, 4760, 4808, 4834, 4892, 5049, 5185, 5306, 5875, 5963, 6079, 6525, 6542, 6543, 6581, 6947, 6986, 7017, 7206, 7766, 7767, 7769, 7905, 8432, 8463, 8507, 8510, 8516, 8561, 8562, 8563, 8564, 8606, 8675, 8855, 8867, 8902, 8941, 8952, 9151, 9163, 9223, 9262, 9267, 9306, 9986, 10359, 10360, 10361, 10363, 10534, 10667, 10681, 10870, 10881, 10885, 11162, 11274, 11795, 11911, 11922, 11923, 11924, 11930, 11998, 12010, 12062, 12167, 12229, 12238, 12271, 12275, 12315, 12433, 12828, 13000, 13094, 13166, 13301, 13302, 13380, 13386, 13387, 13388, 13449, 13450, 13451, 13452, 13453, 13470, 13471, 13486, 13488, 13489, 13524, 13525, 13526, 13712, 14020, 14079, 14080, 14113, 14131, 14132, 14133, 14146, 14150, 14582, 14583, 14586, 14595, 14596, 14597, 14598, 14599, 14941, 14942, 14943, 14944, 14964, 14965, 15044, 15297, 15298, 15299, 15611, 15638, 15640, 15642, 15643, 15802, 17118, 17158, 17185, 17371, 18049, 18202, 18244, 18835, 18948, 18949, 18983, 19084, 19085, 19086, 19561, 19562, 19563, 19564, 19565, 19640, 19741, 19742, 19743, 19744, 19781, 19920, 19953, 20053, 20054, 20055, 20056, 20057, 20062, 20063, 20064, 20065, 20095, 20227, 20228, 20301, 20442, 20456, 20457, 20458, 20459, 20460, 20472, 20473, 20474, 20475, 20853, 21091, 21092, 21093, 21095, 21158, 21233, 21234, 21235, 21257, 21258, 21322, 21335, 21337, 21338, 21376, 21537, 22047, 22402, 22433, 22439, 22582, 22713, 22802, 22803, 22804, 23176, 23416, 23679, 23909, 23934, 23937, 23939, 23966, 24006, 24007, 24008, 24047, 24066, 24086, 24104, 24105, 24177, 24189, 24211, 24236, 24250, 24252, 24261, 24264, 24386, 24444, 24445, 24446, 24472, 24479, 24480, 24590, 24603, 24631, 24635, 24641, 24642, 24646, 24664, 24706, 24707, 24740, 24745, 24756, 24784, 24785, 24786, 24787, 24788, 24789, 24793, 24794, 24795, 24796, 24797, 24800, 24817, 24818, 24866, 24891, 24902, 24903, 24904, 24946, 24952, 24953, 24954, 24955, 24956, 24971, 25062, 25178, 25285, 25286, 25287, 25299, 25307, 25377, 25478, 25570, 25575, 25576, 25605, 25655, 25656, 25888, 25889, 25890, 25900, 25901, 25902, 25908, 25950, 25957, 26020, 26035, 26100, 26151, 26158, 26159, 26160, 26161, 26227, 26239, 26240, 26241, 26350, 26414, 26554, 26562, 26587, 26602, 26603, 26606, 26623, 26642, 26646, 26647, 26666, 26668, 26669, 26683, 26699, 26706, 26714, 26715, 26716, 26717, 26728, 26729, 26753, 26793, 26968, 26969, 26970, 26971, 26972, 27004, 27005, 27052, 27233, 27422, 27428, 27430, 27431, 27435, 27436, 27440, 27441, 27490, 27570, 27716, 27717, 27803, 27805, 27844, 27954, 27955, 27957, 27958, 28057, 28059, 28067, 28073, 28087, 28129, 28191, 28210, 28214, 28379, 28385, 28462, 28483, 28487, 28489, 28490, 28507, 28579, 28991, 29025, 29048, 29049, 29067, 29077, 29189, 29190, 29197, 29254, 29309, 29315, 29428, 29429, 29430, 29468, 29473, 29474, 29475, 29485, 29486, 29487, 29497, 29714, 29723, 29734, 29759, 29844, 29968, 29971, 29972, 29993, 30051, 30058, 30181, 30195, 30196, 30202, 30209, 30223, 30229, 30280, 30300, 30344, 30471, 30502, 30503, 30504, 30602, 30603, 30604, 30605, 30606, 30607, 30640, 30641, 30647, 30648, 30649, 30655, 30656, 30657, 30658, 30659, 30660, 30662, 30663, 30664, 30796, 30809, 30810, 30829, 30830, 30882, 30883, 30896, 30899, 30902, 30904, 30912, 30918, 30937, 30977, 30979, 30980, 30981, 30982, 30995, 30997, 31076, 31077, 31078, 31125, 31163, 31164, 31165, 31182, 31201, 31202, 31203, 31204, 31205, 31297, 31299, 31300, 31301, 31312, 31313, 31412, 31413, 31454, 31457, 31458, 31459, 31460, 31461, 31528, 31613, 31617, 31669, 31670, 31679, 31728, 31735, 31860, 31861, 31862, 31863, 31890, 31893, 31910, 31919, 31921, 31950, 31951, 31952, 31966, 31967, 31997, 31999, 32000, 32004, 32005, 32006, 32012, 32017, 32018, 32020, 32021, 32031, 32047, 32048, 32049, 32050, 32051, 32052, 32083, 32084, 32085, 32110, 32111, 32112, 32113, 32122, 32123, 32146, 32164, 32165, 32166, 32170, 32172, 32193, 32194, 32196, 32209, 32210, 32211, 32212, 32213, 32266, 32268, 32269, 32270, 32271, 32272, 32273, 32280, 32281, 32282, 32283, 32284, 32285, 32286, 32287, 32293, 32299, 32300, 32301, 32302, 32303, 32304, 32305, 32307, 32311, 32312, 32313, 32314, 32315, 32316, 32317, 32331, 32369, 32383, 32420, 32427, 32428, 32429, 32443, 32444, 32457, 32491, 32492, 32493, 32494, 32495, 32519, 32520, 32527, 32551, 32562, 32566, 32567, 32568, 32569, 32570, 32581, 32589, 32590, 32599, 32645, 32646, 32647, 32648, 32649, 32667, 32668, 32669, 32670, 32749, 32907, 32972, 32973, 32995, 32996, 33065, 33066, 33068, 33069, 33109, 33148, 33184, 33339, 33409, 33426, 33479, 33487, 33488, 33567, 33568, 33569, 33609, 33651, 33652, 33653, 33654, 33655, 33659) 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