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(485, 505, 596, 634, 758, 798, 817, 1058, 1060, 1061, 1062, 1063, 1065, 1067, 1069, 1070, 1072, 1076, 1078, 1082, 1145, 1202, 1276, 1578, 1589, 1590, 1591, 1592, 1593, 1594, 1597, 1616, 1930, 1933, 1947, 1949, 2100, 2101, 2102, 2104, 2107, 2108, 2189, 2324, 2474, 2480, 2488, 2493, 2499, 2511, 2566, 2571, 2667, 2668, 2671, 2673, 2674, 2676, 2692, 2741, 2745, 2816, 2903, 3132, 3188, 3194, 3214, 3274, 3294, 3345, 3347, 3364, 3369, 3446, 3447, 3487, 3488, 3538, 3592, 3596, 3597, 3598, 3606, 3616, 3617, 3661, 3673, 3674, 3686, 3687, 3695, 3721, 3722, 3724, 3784, 3866, 3950, 3951, 3965, 4019, 4037, 4046, 4095, 4135, 4149, 4280, 4333, 4386, 4404, 4409, 4610, 4636, 4665, 4717, 4869, 5039, 5059, 5066, 5067, 5496, 5572, 5601, 5610, 5669, 5681, 5682, 5783, 5817, 5818, 5825, 5851, 5863, 5955, 5956, 6006, 6087, 6088, 6103, 6146, 6147, 6187, 6365, 6366, 6367, 6368, 6377, 6492, 6498, 6499, 6500, 6510, 6511, 6513, 6544, 6741, 7077, 7088, 7160, 7214, 7227, 7252, 7399, 7413, 7509, 7616, 7694, 7700, 7771, 7779, 7780, 7926, 7998, 7999, 8005, 8063, 8067, 8150, 8152, 8192, 8193, 8256, 8257, 8264, 8326, 8331, 8695, 8696, 8701, 8702, 8703, 8775, 8789, 8839, 8850, 8958, 8971, 9023, 9032, 9033, 9034, 9184, 9196, 9253, 9401, 9417, 9418, 9447, 9448, 9449, 9450, 9451, 9468, 9469, 9470, 9471, 9478, 9501, 9564, 9588, 9602, 9624, 9650, 9653, 9737, 9756, 9784, 9908, 9912, 9915, 9931, 10406, 10449, 10476, 10488, 10502, 10621, 10791, 10792, 10794, 10795, 10814, 10821, 10863, 11076, 11167, 11225, 11232, 11347, 11397, 11405, 11417, 11427, 11533, 11646, 11649, 11697, 11857, 11871, 11880, 12020, 12070, 12108, 12112, 12240, 12314, 12466, 12617, 12821, 12822, 12929, 12930, 12931, 12932, 12933, 12940, 12941, 12961, 12963, 13002, 13003, 13004, 13005, 13010, 13037, 13068, 13070, 13089, 13090, 13106, 13159, 13177, 13208, 13209, 13211, 13242, 13245, 13287, 13371, 13544, 13685, 13821, 13823, 13825, 13962, 13991, 13992, 14023, 14040, 14190, 14223, 14258, 14432, 14466, 14545, 14604, 14607, 14615, 14630, 14745, 14756, 14757, 14945, 15017, 15037, 15136, 15270, 15282, 15293, 15421, 15422, 15442, 15449, 15468, 15516, 15520, 15559, 15568, 15603, 15679, 15694, 15701, 15748, 15769, 15796, 15897, 15898, 15977, 16049, 16353, 16600, 16623, 16742, 16781, 16782, 16971, 17086, 17328, 17343, 17489, 17536, 17566, 17778, 17781, 17838, 17851, 17852, 17853, 18029, 18044, 18182, 18238, 18283, 18299, 18342, 18353, 18458, 18459, 18461, 18462, 18496, 18497, 18498, 18499, 18606, 18609, 18613, 18617, 18693, 18719, 18720, 18785, 18800, 18801, 18814, 18815, 18816, 18826, 18828, 18888, 18911, 18935, 18936, 18950, 18951, 18953, 18962, 18975, 18976, 18987, 18993, 18994, 18995, 18996, 19002, 19003, 19004, 19005, 19007, 19013, 19020, 19096, 19115, 19120, 19278, 19372, 19499, 19606, 19607, 19608, 19609, 19610, 19611, 19612, 19613, 19614, 19615, 19623, 19628, 19645, 19668, 19675, 19695, 19794, 19835, 19836, 19846, 19864, 19933, 19944, 19945, 19946, 19947, 20026, 20027, 20028, 20029, 20091, 20182, 20195, 20196, 20212, 20278, 20408, 20471, 20572, 20601, 20622, 20624, 20625, 20704, 20722, 20723, 20738, 20740, 20741, 20742, 20793, 20805, 20864, 20871, 20879, 20890, 20891, 20893, 20898, 20904, 20969, 20993, 21055, 21056, 21134, 21136, 21137, 21162, 21164, 21245, 21279, 21282, 21284, 21454, 21552, 21561, 21628, 21630, 21745, 21746, 21812, 21829, 21842, 21853, 21908, 21949, 21954, 22016, 22096, 22231, 22232, 22233, 22234, 22279, 22280, 22318, 22321, 22322, 22323, 22371, 22460, 22465, 22551, 22587, 22602, 22682, 22698, 22773, 22811, 22887, 22893, 22898, 22999, 23000, 23001, 23002, 23071, 23072, 23074, 23080, 23081, 23082, 23108, 23366, 23405, 23446, 23467, 23579, 23618, 23619, 23675, 23701, 23741, 23774, 23893, 23927, 24037, 24042, 24085, 24091, 24152, 24199, 24200, 24208, 24473, 24619, 24644, 24680, 24730, 24819, 24992, 25025, 25070, 25073, 25074, 25120, 25174, 25187, 25281, 25326, 25341, 25352, 25600, 25885, 25916, 26203, 26205, 26225, 26258, 26261, 26363, 26417, 26607, 26608, 26894, 27780, 27914, 28189, 28254, 28433, 28454, 28525, 28526, 28527, 28528, 28996, 29093, 29094, 29095, 29112, 29113, 29115, 29116, 29191, 29300, 29301, 29311, 29537, 29659, 29698, 29730, 29790, 29868, 29909, 29910, 30302, 30631, 30636, 30638, 30644, 30650, 30652, 30653, 30681, 30684, 30720, 30723, 30724, 30807, 30894, 30895, 30949, 30950, 30983, 31030, 31074, 31166, 31167, 31233, 31235, 31348, 31349, 31466, 31502, 31600, 31770, 31854, 32151, 32215, 32231, 32352, 32529, 32793, 32908, 32952, 32953, 33511, 33512, 33513, 33514, 33561) 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