Код: Выделить всё
select e.id from app_entity_55 e where e.id='57' and ((select count(*) as total from app_entity_55_values cv where cv.items_id=e.id and cv.fields_id='505' and cv.value='1')>0 or e.created_by='1')Код: Выделить всё
select e.id from app_entity_55 e where e.id='57' and ((select count(*) as total from app_entity_55_values cv where cv.items_id=57 and cv.fields_id='505' and cv.value='1')>0 or e.created_by='1')Разница только в cv.items_id=e.id и cv.items_id=57
По какой причине может не срабатывать вложенный запрос если указано cv.items_id=e.id?