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(19, 377, 501, 653, 684, 818, 953, 954, 957, 964, 980, 1012, 1320, 1398, 1399, 1410, 1411, 1706, 1960, 2030, 2036, 2037, 2038, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052, 2053, 2054, 2055, 2056, 2057, 2059, 2193, 2318, 2319, 2320, 2322, 2329, 2330, 2334, 2335, 2336, 2349, 2350, 2354, 2355, 2356, 2360, 2361, 2362, 2370, 2371, 2387, 2388, 2389, 2392, 2398, 2399, 2452, 2470, 2472, 2517, 2617, 2618, 2723, 2724, 2725, 2726, 2728, 2729, 2730, 2731, 2732, 2734, 2735, 2736, 2737, 2738, 2740, 3063, 3140, 3495, 3530, 3558, 3575, 3814, 3845, 3870, 3945, 3973, 3975, 3989, 3995, 4069, 4096, 4120, 4129, 4205, 4206, 4249, 4297, 4477, 4479, 4512, 4535, 4630, 4737, 4746, 4801, 4833, 4903, 5030, 5042, 5100, 5214, 5247, 5295, 5345, 5429, 5490, 5732, 5736, 5816, 6074, 6104, 6128, 6226, 6239, 6241, 6274, 6277, 6288, 6327, 6385, 6611, 6630, 6689, 6707, 6805, 6806, 6811, 6853, 6854, 6864, 6871, 6874, 6971, 6999, 7000, 7004, 7014, 7022, 7024, 7031, 7109, 7115, 7116, 7117, 7155, 7156, 7157, 7168, 7280, 7294, 7315, 7319, 7348, 7477, 7504, 7529, 7538, 7540, 7542, 7572, 7622, 7644, 7652, 7668, 7789, 7850, 7886, 8006, 8114, 8122, 8144, 8288, 8305, 8360, 8568, 8637, 8713, 8733, 8826, 8995, 8998, 9049, 9146, 9203, 9460, 9494, 9495, 9514, 9525, 9535, 9561, 9565, 9705, 9758, 9759, 9822, 9962, 9983, 9995, 10003, 10016, 10030, 10050, 10056, 10422, 10596, 10602, 10674, 10685, 10750, 10753, 10805, 10807, 10808, 10928, 10972, 11071, 11123, 11168, 11212, 11214, 11233, 11330, 11360, 11394, 11447, 11511, 11539, 11547, 11627, 11644, 11736, 11755, 11757, 11764, 11765, 11766, 11790, 11812, 12063, 12222, 12416, 12478, 12486, 12608, 12754, 12959, 13125, 13193, 13206, 13321, 13420, 13502, 13572, 13574, 13580, 13586, 13587, 13589, 13601, 13646, 13667, 13669, 13672, 13738, 13839, 13939, 13954, 14013, 14025, 14026, 14049, 14062, 14063, 14158, 14177, 14187, 14240, 14244, 14251, 14252, 14253, 14268, 14269, 14270, 14311, 14394, 14419, 14444, 14542, 14775, 14939, 14955, 15156, 15169, 15265, 15287, 15326, 15327, 15335, 15389, 15411, 15511, 15545, 15631, 15636, 15682, 15766, 15818, 15906, 15946, 16103, 16265, 16542, 16604, 16662, 16672, 16759, 16972, 17165, 17188, 17310, 17318, 17386, 17421, 17522, 17943, 17963, 17966, 17981, 17992, 18005, 18053, 18116, 18255, 18276, 18318, 18363, 18390, 18402, 18422, 18531, 18668, 18703, 18749, 18788, 18837, 18838, 18866, 18867, 18868, 18989, 19064, 19070, 19107, 19111, 19237, 19305, 19306, 19307, 19308, 19309, 19315, 19316, 19455, 19463, 19547, 19548, 19618, 19657, 19670, 19703, 19704, 19738, 19749, 19750, 19760, 19772, 19777, 19837, 19940, 19941, 19981, 20010, 20120, 20428, 20579, 20617, 20619, 20649, 20732, 20734, 20736, 20746, 20836, 20899, 20900, 20924, 20983, 21062, 21121, 21127, 21165, 21261, 21263, 21264, 21312, 21313, 21314, 21402, 21422, 21615, 21671, 21783, 21809, 21811, 21825, 21826, 21841, 21861, 21898, 21957, 22085, 22088, 22109, 22191, 22194, 22211, 22212, 22214, 22217, 22220, 22222, 22241, 22243, 22329, 22415, 22500, 22508, 22552, 22576, 22596, 22597, 22669, 22797, 22807, 22808, 22822, 22843, 22882, 22884, 22914, 22915, 22928, 22950, 23068, 23186, 23300, 23360, 23396, 23397, 23450, 23461, 23563, 23564, 23662, 23707, 23716, 23729, 23854, 23856, 23858, 23859, 23860, 23862, 23863, 23864, 23867, 23868, 23869, 23870, 23871, 23875, 23888, 23896, 23897, 23917, 23918, 23922, 23930, 23933, 23956, 23984, 23985, 23986, 23987, 23988, 23993, 23998, 23999, 24001, 24054, 24093, 24095, 24129, 24154, 24214, 24290, 24293, 24294, 24300, 24302, 24303, 24304, 24314, 24316, 24320, 24321, 24322, 24323, 24324, 24325, 24326, 24327, 24328, 24329, 24330, 24331, 24332, 24333, 24334, 24335, 24340, 24341, 24342, 24343, 24344, 24345, 24346, 24347, 24349, 24351, 24352, 24354, 24357, 24358, 24361, 24362, 24364, 24365, 24366, 24367, 24368, 24369, 24370, 24436, 24438, 24441, 24442, 24443, 24545, 24731, 24820, 25094, 25096, 25097, 25098, 25099, 25100, 25101, 25102, 25103, 25105, 25112, 25114, 25115, 25116, 25117, 25118, 25145, 25146, 25147, 25148, 25149, 25150, 25152, 25153, 25156, 25157, 25215, 25216, 25217, 25218, 25219, 25220, 25221, 25222, 25223, 25224, 25225, 25226, 25227, 25228, 25229, 25230, 25231, 25232, 25241, 25242, 25243, 25244, 25246, 25248, 25249, 25267, 25315, 25316, 25317, 25318, 25319, 25474, 25475, 25555, 25638, 25680, 25691, 25904, 25985, 26038, 26093, 26139, 26163, 26172, 26175, 26177, 26219, 26232, 26233, 26234, 26247, 26268, 26364, 26372, 26401, 26419, 26475, 26493, 26494, 26521, 26522, 26532, 27189, 27190, 27191, 27392, 27519, 27537, 27926, 27927, 28068, 28484, 28681, 28875, 28876, 28900, 28929, 29299, 29319, 29320, 29321, 29322, 29323, 29324, 29325, 29326, 29327, 29328, 29337, 29400, 29797, 29836, 29862, 30324, 30433, 30767, 30768, 31126, 31153, 31154, 31155, 31156, 31157, 31170, 31305, 31362, 31504, 31506, 31507, 32079, 32080, 32086, 32465, 32537, 32733, 32798, 32799, 33341, 33526, 33527, 33551, 33597) 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