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(150, 233, 468, 995, 1013, 1346, 1692, 2027, 2079, 2433, 2641, 3018, 3019, 3020, 3414, 3421, 3555, 3833, 4024, 4056, 4084, 4632, 4860, 4880, 5006, 5080, 5136, 5489, 5541, 5557, 5602, 5603, 5604, 5605, 5606, 5860, 6018, 6862, 6984, 7067, 7108, 7261, 7448, 7473, 7756, 8324, 8368, 8369, 8503, 9567, 10056, 10410, 10637, 10670, 11359, 11585, 11637, 11779, 11960, 12101, 12542, 12778, 12884, 13013, 13533, 13623, 13651, 13687, 13755, 13952, 14160, 14222, 14614, 14665, 14936, 14937, 15138, 15165, 15329, 15352, 15722, 15943, 15944, 16482, 16499, 16531, 16687, 17424, 17426, 17427, 17428, 17429, 17452, 17453, 17454, 17514, 17674, 17680, 17895, 18003, 18233, 18334, 18420, 18467, 18527, 18542, 18598, 18607, 18705, 18706, 18752, 18792, 18821, 18851, 18919, 18920, 18958, 19180, 19507, 19597, 19599, 19626, 19683, 19733, 19734, 19790, 19801, 19950, 19951, 20130, 20143, 20204, 20210, 20424, 20511, 20559, 20724, 20725, 20765, 20838, 20839, 21190, 21346, 21398, 21399, 21406, 21431, 21458, 21459, 21460, 21501, 21513, 21515, 21516, 21547, 21548, 21604, 21621, 21655, 21656, 21672, 21702, 21703, 21705, 21795, 21823, 21876, 22154, 22206, 22221, 22239, 22351, 22352, 22446, 22473, 22868, 22911, 22930, 22931, 22981, 23763, 23765, 24030, 24034, 24123, 24129, 24130, 24317, 24475, 24802, 25018, 25146, 25147, 25157, 25182, 25221, 25231, 25252, 25253, 25255, 25257, 25259, 25475, 25617, 25618, 25619, 25653, 25678, 25679, 25682, 26022, 26091, 26092, 26093, 26095, 26096, 26104, 26105, 26106, 26107, 26108, 26113, 26114, 26115, 26116, 26117, 26122, 26123, 26128, 26129, 26130, 26131, 26132, 26135, 26136, 26137, 26138, 26139, 26152, 26153, 26154, 26155, 26156, 26165, 26166, 26167, 26168, 26169, 26175, 26190, 26191, 26192, 26193, 26194, 26213, 26214, 26215, 26220, 26221, 26222, 26223, 26249, 26250, 26251, 26252, 26253, 26262, 26264, 26265, 26266, 26281, 26282, 26334, 26335, 26380, 26423, 26472, 26473, 26476, 27132, 27607, 27801, 27804, 27840, 27924, 27925, 27928, 28096, 28097, 28098, 28099, 28105, 28106, 28107, 28108, 28109, 28110, 28115, 28116, 28117, 28118, 28119, 28122, 28123, 28124, 28125, 28126, 28175, 28176, 31490, 31496, 31501, 31505, 31508, 31509, 31556, 32472) 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