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(669, 769, 770, 851, 1238, 1240, 1743, 1744, 1883, 3046, 3969, 4255, 6014, 6036, 6052, 6393, 7979, 8903, 8904, 8905, 8906, 8907, 9445, 10072, 10091, 10092, 10093, 10094, 10126, 10127, 10128, 10129, 10130, 10143, 10144, 10145, 10146, 10147, 10193, 10194, 10195, 10196, 10197, 10209, 10210, 10211, 10212, 10213, 10224, 10225, 10226, 10227, 10228, 10230, 10231, 10232, 10233, 10234, 10237, 10238, 10239, 10240, 10241, 10243, 10244, 10245, 10246, 10247, 10249, 10250, 10251, 10252, 10259, 10260, 10261, 10262, 10263, 10277, 10278, 10279, 10280, 10281, 10287, 10288, 10289, 10290, 10291, 10296, 10297, 10298, 10299, 10300, 10303, 10304, 10305, 10306, 10307, 11105, 11106, 11107, 11108, 11109, 11153, 11154, 11155, 11156, 11157, 11207, 11208, 11209, 11210, 11211, 11705, 11706, 11707, 11708, 11709, 11834, 11835, 11836, 11839, 12979, 12980, 12981, 12982, 12983, 13396, 13884, 14345, 14350, 15002, 15100, 15112, 15177, 15532, 17280, 17281, 17551, 17552, 17554, 17555, 17556, 17557, 17558, 17562, 17563, 17564, 17568, 17569, 17570, 17571, 17572, 17581, 17582, 17583, 17584, 17585, 17608, 17609, 17610, 17908, 18248, 18309, 19715, 21445, 21449, 21453, 21633, 21635, 21636, 21667, 21668, 21669, 21694, 21696, 22759, 22761, 22762, 22883, 23488, 23621, 23899, 23907, 23940, 23965, 23968, 23969, 23976, 23977, 24045, 24053, 24067, 24110, 24111, 24112, 24113, 24116, 24121, 24134, 24135, 24138, 24139, 24141, 24233, 25382, 25428, 26050, 26365, 26366, 26367, 26394, 26403, 26407, 26537, 26952, 27557, 27893, 29347, 29348, 29371, 29372, 29373, 29409, 29413, 29448, 29449, 29463, 29725, 29732, 29733, 29897, 29898, 29899, 29984, 30061, 30074, 30075, 30076, 30077, 30079, 30089, 30102, 30383, 30384, 30386, 30564, 30565, 30566, 30573, 30597, 30598, 30599, 30905, 31022, 31023, 31024, 31025, 31032, 31127, 31324, 31325, 31326, 31327, 31328, 31329, 31330, 31331, 31332, 31333, 31340, 31341, 31342, 31343, 31344, 31370, 31371, 31372, 31373, 31374, 31390, 31482, 31510, 31511, 31512, 31513, 31514, 31534, 31535, 31536, 31537, 31538, 31541, 31542, 31543, 31544, 31545, 31546, 31547, 31548, 31549, 31550, 31551, 31552, 31553, 31554, 31555, 31619, 31886, 31887, 32155, 32159, 32482) 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