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(554, 675, 759, 784, 836, 875, 928, 1209, 1645, 1646, 1647, 1729, 1859, 2180, 2181, 2536, 2647, 2650, 2651, 3161, 3165, 3166, 3169, 3170, 3171, 3172, 3173, 3175, 3201, 3293, 3334, 3475, 3622, 3624, 3625, 3626, 3649, 3650, 3651, 3652, 3654, 3726, 3727, 3728, 3729, 3752, 3791, 3792, 3810, 3812, 3823, 4612, 4843, 4920, 4922, 5222, 5292, 5349, 5609, 5932, 5933, 5945, 5952, 5961, 5962, 6152, 6162, 6164, 6230, 6232, 6233, 6286, 6311, 6312, 6652, 6704, 6705, 6843, 6982, 7053, 7063, 7064, 7065, 7193, 7251, 7484, 7556, 7564, 7586, 8084, 8172, 8290, 8291, 8311, 8374, 8457, 8723, 8796, 8838, 8861, 9118, 9134, 9251, 9492, 9585, 9586, 9775, 9809, 9810, 9811, 9812, 9813, 9823, 9824, 9825, 9826, 9903, 10088, 10576, 10949, 11050, 11068, 11099, 11243, 11257, 11399, 11413, 11432, 11433, 11616, 11629, 11648, 11780, 11781, 11791, 11792, 11793, 11833, 11840, 11841, 11957, 11994, 12047, 12057, 12402, 12973, 13036, 13078, 13152, 13168, 13171, 13172, 13173, 13201, 13546, 13733, 13758, 13870, 13873, 13921, 13947, 14036, 14037, 14282, 14330, 14838, 14852, 14854, 14876, 14933, 15030, 15045, 15259, 15260, 15261, 15262, 15263, 15346, 15391, 15414, 15443, 15444, 15463, 15517, 15523, 15547, 15720, 15776, 15779, 15855, 15856, 15858, 15890, 15927, 15958, 16089, 16119, 16369, 16410, 16454, 16678, 16698, 16701, 16807, 16813, 16932, 17053, 17110, 17236, 17288, 17340, 17359, 17388, 17548, 17950, 18149, 18181, 18189, 18243, 18341, 18391, 18515, 18536, 18587, 18812, 18856, 18910, 19078, 19355, 19497, 19541, 19621, 19642, 19666, 19667, 19696, 19737, 19784, 19813, 19845, 19870, 19932, 19958, 19959, 19987, 20262, 20295, 20410, 20414, 20454, 20542, 20615, 20640, 20677, 20682, 20761, 20781, 20782, 20812, 20955, 21382, 21434, 21490, 21559, 21654, 21655, 21743, 21802, 21807, 21824, 21827, 21828, 21830, 21836, 21837, 21838, 21868, 21894, 21914, 21927, 21929, 21977, 22140, 22141, 22142, 22143, 22144, 22147, 22148, 22182, 22246, 22267, 22268, 22270, 22298, 22338, 22346, 22347, 22348, 22349, 22496, 22554, 22568, 22736, 22798, 22825, 22875, 22876, 22900, 22940, 22941, 22942, 22943, 22944, 22956, 22993, 23053, 23098, 23133, 23134, 23135, 23189, 23218, 23297, 23301, 23451, 23487, 23586, 23618, 23702, 23717, 23742, 23750, 23767, 23834, 24035, 24044, 24238, 24292, 24403, 24668, 24726, 24772, 24773, 24941, 25294, 25301, 25333, 25334, 25335, 25336, 25416, 25598, 25620, 25621, 26178, 26212, 26362, 27811, 28045, 28822, 28867, 29137, 29316, 29318, 29404, 29405, 29406, 29407, 29408, 29415, 29416, 29417, 29418, 29419, 29420, 29421, 29422, 29423, 29424, 29425, 29426, 29455, 29456, 29763, 30510, 30898, 30918, 30979, 30980, 31009, 31010, 31011, 31401, 31575, 31597, 31689, 31837, 31841, 31917, 32127, 32807, 32809, 33344, 33345, 33603) 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