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(744, 1723, 2504, 3336, 3474, 3691, 3850, 3926, 3927, 4262, 4420, 4802, 4824, 4825, 4846, 4910, 4949, 5267, 5328, 5355, 5356, 5357, 5359, 5366, 5524, 5597, 5608, 5694, 5903, 5982, 6440, 6441, 6533, 6534, 6594, 6699, 6763, 6764, 6779, 6781, 7278, 7390, 7570, 7903, 7957, 8258, 8299, 8300, 8506, 8600, 9191, 9383, 9419, 9511, 9612, 9613, 10004, 10023, 10024, 10089, 10321, 10477, 10478, 11669, 12200, 12211, 12489, 12532, 12568, 12667, 13083, 13111, 13153, 13175, 13205, 13336, 13383, 13391, 13657, 13697, 13714, 13809, 13818, 13906, 13911, 13912, 13913, 13967, 13969, 14183, 14276, 14333, 14682, 15028, 15167, 15319, 15436, 15597, 15668, 15692, 15827, 15941, 15952, 15953, 15959, 16317, 16601, 16602, 16617, 17087, 17102, 17110, 17295, 17340, 17598, 17600, 17770, 17881, 17892, 17950, 18012, 18013, 18015, 18016, 18085, 18179, 18595, 18596, 18597, 18636, 18649, 18709, 18710, 18711, 18762, 18834, 18901, 18907, 18973, 19196, 19345, 19490, 19815, 20007, 20017, 20018, 20019, 20020, 20021, 20022, 20030, 20036, 20038, 20052, 20115, 20118, 20144, 20145, 20146, 20147, 20148, 20150, 20158, 20173, 20256, 20524, 20616, 20640, 20642, 20643, 20680, 20681, 20683, 20692, 20697, 20700, 20718, 20726, 20776, 20823, 20908, 20909, 20910, 20911, 20912, 20925, 20926, 20927, 20928, 20929, 20945, 20947, 20956, 20959, 20960, 20962, 20963, 20964, 20966, 20967, 20972, 20973, 20974, 20975, 20976, 20996, 20997, 21243, 21259, 21266, 21276, 21298, 21299, 21354, 21355, 21408, 21423, 21425, 21426, 21433, 21440, 21441, 21442, 21450, 21471, 21472, 21485, 21521, 21522, 21524, 21525, 21526, 21645, 21813, 21814, 21815, 21834, 21844, 21924, 22184, 22186, 22237, 22238, 22266, 22271, 22281, 22295, 22361, 22691, 22693, 22694, 22705, 22706, 22707, 22733, 22749, 22750, 22751, 22954, 22961, 22962, 22963, 23094, 23095, 23106, 23118, 23119, 23121, 23161, 23197, 23212, 23218, 23296, 23329, 23670, 23799, 23809, 23810, 23817, 23818, 23819, 24267, 24374, 24376, 24378, 24391, 24792, 24875, 24985, 25141, 25240, 25251, 25345, 25910, 25924, 25967, 25996, 26036, 26189, 26337, 26497, 26995, 27205, 27968, 27969, 28464, 28465, 30029, 30031, 30032, 30153, 30274, 30429, 30625, 30709, 30711, 30996, 31229, 31240, 31242, 31323, 31368, 31605, 31737, 31764, 31765, 31767, 31768, 31769, 31771, 31774, 31777, 31778, 31780, 31784, 31796, 31797, 31798, 31801, 31802, 31803, 31805, 31806, 31871, 32318, 32319, 32320, 32615, 33270, 33319) 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