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(491, 1008, 1010, 1449, 1459, 1477, 1486, 1677, 1678, 1679, 1690, 1691, 1696, 1697, 1702, 1703, 1827, 1828, 1829, 1830, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1844, 1845, 1846, 1847, 1848, 1849, 1850, 1851, 1861, 1871, 1872, 1885, 1886, 1887, 1996, 1997, 1998, 1999, 2002, 2003, 2004, 2005, 2010, 2025, 2026, 2265, 2439, 2476, 2477, 2481, 2482, 2483, 2491, 2496, 2497, 2501, 2502, 2506, 2507, 2523, 2527, 2532, 2542, 2543, 2544, 2547, 2548, 2567, 2568, 2569, 2570, 2572, 2573, 2574, 2575, 2576, 2577, 2578, 2579, 2614, 3039, 3040, 3068, 3130, 3195, 3228, 3238, 3311, 3367, 3494, 3515, 3587, 3588, 3589, 3612, 3748, 3749, 3750, 3751, 3793, 3907, 3952, 4033, 4034, 4093, 4102, 4122, 4134, 4159, 4222, 4223, 4227, 4290, 4343, 4480, 4566, 4724, 4728, 4774, 4778, 4890, 4970, 5001, 5004, 5105, 5107, 5108, 5109, 5120, 5121, 5122, 5124, 5144, 5145, 5146, 5147, 5148, 5150, 5151, 5193, 5290, 5346, 5408, 5409, 5411, 5412, 5451, 5466, 5509, 5520, 5555, 5639, 5691, 5704, 5752, 5754, 5755, 5756, 5776, 5777, 5778, 5794, 5795, 5801, 5816, 5842, 5988, 5992, 6046, 6097, 6099, 6106, 6107, 6108, 6109, 6110, 6122, 6123, 6124, 6125, 6126, 6138, 6140, 6222, 6302, 6509, 6532, 6535, 6536, 6658, 6770, 6795, 6861, 7040, 7042, 7062, 7120, 7276, 7353, 7408, 7418, 7486, 7527, 7543, 7788, 7797, 7841, 7982, 8042, 8044, 8081, 8113, 8193, 8201, 8203, 8240, 8242, 8349, 8353, 8399, 8446, 8466, 8526, 8607, 8656, 8718, 8845, 8848, 8958, 8974, 8975, 8992, 9156, 9254, 9567, 9667, 9701, 9702, 9703, 9727, 10181, 10324, 10393, 10525, 10549, 10554, 10571, 10705, 10706, 10707, 10710, 10739, 10772, 10777, 10847, 10888, 10903, 11022, 11035, 11072, 11073, 11217, 11384, 11390, 11465, 11467, 11505, 11520, 11562, 11592, 11668, 11738, 11867, 11887, 11891, 11908, 12002, 12129, 12365, 12382, 12473, 12543, 12589, 12633, 12709, 12736, 12950, 13602, 13682, 13683, 14004, 14038, 14139, 14140, 14141, 14142, 14294, 14328, 14483, 14594, 14615, 14634, 14648, 14662, 14683, 14839, 15147, 15226, 15227, 15375, 15376, 15751, 15905, 15985, 16039, 16081, 16262, 16359, 16374, 16464, 16622, 16722, 16729, 16797, 16852, 17274, 17410, 17889, 17994, 18167, 18433, 18469, 18479, 18866, 19195, 19272, 19275, 19314, 19454, 19528, 19581, 19597, 19598, 19599, 19600, 19601, 19602, 19603, 19605, 19752, 19792, 19924, 20159, 20251, 20731, 20847, 20848, 20920, 20939, 21297, 21326, 21568, 21770, 21858, 21900, 21926, 21937, 22032, 22208, 22221, 22226, 22227, 22325, 22330, 22351, 22352, 22353, 22842, 22869, 22893, 23171, 23298, 23730, 23754, 23813, 23841, 23842, 23849, 23853, 23877, 23878, 24016, 24018, 24074, 24109, 24243, 24308, 24309, 24448, 24449, 24547, 24577, 25119, 25245, 25247, 25347, 25557, 25572, 25711, 25712, 25973, 26040, 26041, 26042, 26043, 26044, 26051, 26052, 26053, 26054, 26055, 26065, 26066, 26067, 26068, 26069, 26081, 26082, 26083, 26084, 26085, 26119, 26120, 26121, 26164, 26224, 26286, 26287, 26288, 26289, 26290, 26291, 26292, 26293, 26294, 26295, 26310, 26311, 26312, 26313, 26314, 26318, 26319, 26320, 26321, 26322, 26331, 26332, 26333, 26474, 26859, 26937, 26938, 28042, 28495, 28506, 28595, 28596, 28597, 28598, 28599, 28987, 29031, 29033, 29299, 29355, 29356, 29357, 29358, 29364, 29397, 29450, 29451, 29766, 29872, 29873, 30080, 30361, 30741, 31080, 31131, 31175, 31183, 31193, 31749, 31772, 31785, 31787, 31788, 31790, 31791, 32326, 32353, 32535, 32536, 32633, 32634, 32635, 32636, 32637, 32641, 32704, 32706, 32707, 32820, 33334, 33530) 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