|
|
|
|
|
|
|
|
|
|
|
select ifnull(lng_tex.tex_text, uni_tex.tex_text) bez,
tof_models.mod_id,
tof_models.mod_pc,
tof_models.mod_cv,
mod_pcon_start,
mod_pcon_end,
mod_mfa_id
from tof_models
left outer join tof_country_designations uni_des
on mod_cds_id = uni_des.cds_id
and uni_des.cds_lng_id = 255
and substring(uni_des.cds_ctm,52,1)=1
left outer join tof_des_texts uni_tex
on uni_des.cds_tex_id = uni_tex.tex_id
left outer join tof_country_designations lng_des
on mod_cds_id = lng_des.cds_id
and lng_des.cds_lng_id = 1
and substring(lng_des.cds_ctm,52,1)=1
left outer join tof_des_texts lng_tex
on lng_des.cds_tex_id = lng_tex.tex_id
where mod_mfa_id = 525
and ( ( 1 = 1 and 0 = 1
and ( tof_models.mod_pc = 1 or tof_models.mod_cv = 0 )
and ( substring(mod_pc_ctm,52,1)=1 or substring(mod_cv_ctm,52,1)=1)
)
or ( 1 = 0 and 0 = 1 and ( tof_models.mod_cv = 0 ) and substring(mod_cv_ctm,52,1)=1)
or ( 1 = 1 and 0 = 0 and ( tof_models.mod_pc = 1 ) and substring(mod_pc_ctm,52,1)=1)
)
and ( (0 = 1 and ( mod_id in (select fil_value
from tof_filters
join tof_models mod1
on fil_value = mod1.mod_id
where fil_kind = 2
and fil_uss_id = 1 )
or not exists (select 1
from tof_filters
join tof_models mod2
on fil_value = mod2.mod_id
where fil_kind = 2
and fil_uss_id = 1
and ( ( mod2.mod_pc = 1 and substring(mod2.mod_pc_ctm,52,1)=1 )
or ( mod2.mod_cv = 1 and substring(mod2.mod_cv_ctm,52,1)=1 )
)
and mod2.mod_mfa_id = 525 )
)
)
or (0 = 0 )
) order by bez
| | | | |