GatuZa
Новичок
ошибка Must specify table to select from.
запрос:
$query=$this->db->query("
select case
when isnull(info_tasktype.grouptask,0) = 0 then
(select top 1 t.id from info_task t where t.company_id = info_task.company_id and t.responsible_id = info_task.responsible_id
and t.datefrom > info_task.datefrom and t.tasktype_id in (SELECT info_tasktype.id FROM info_tasktype WHERE isnull(info_tasktype.grouptask,0) = 0)
order by t.datefrom asc)
when info_tasktype.grouptask = 2 then
(select top 1 t.id from info_task t where t.company_id = info_task.company_id and t.contact_id = info_task.contact_id and t.responsible_id = info_task.responsible_id
and t.datefrom > info_task.datefrom and t.tasktype_id in (SELECT info_tasktype.id FROM info_tasktype WHERE isnull(info_tasktype.grouptask,0) = 2)
order by t.datefrom asc)
end as id,
info_task.tasktype_id
from info_task
inner join info_tasktype on info_tasktype.id = info_task.tasktype_id
where info_task.id =".$this->db->escape($task_id));
на сервере работает нормально, но через CI что-то не хочет... может кто-то знает в чем проблема?!
запрос:
$query=$this->db->query("
select case
when isnull(info_tasktype.grouptask,0) = 0 then
(select top 1 t.id from info_task t where t.company_id = info_task.company_id and t.responsible_id = info_task.responsible_id
and t.datefrom > info_task.datefrom and t.tasktype_id in (SELECT info_tasktype.id FROM info_tasktype WHERE isnull(info_tasktype.grouptask,0) = 0)
order by t.datefrom asc)
when info_tasktype.grouptask = 2 then
(select top 1 t.id from info_task t where t.company_id = info_task.company_id and t.contact_id = info_task.contact_id and t.responsible_id = info_task.responsible_id
and t.datefrom > info_task.datefrom and t.tasktype_id in (SELECT info_tasktype.id FROM info_tasktype WHERE isnull(info_tasktype.grouptask,0) = 2)
order by t.datefrom asc)
end as id,
info_task.tasktype_id
from info_task
inner join info_tasktype on info_tasktype.id = info_task.tasktype_id
where info_task.id =".$this->db->escape($task_id));
на сервере работает нормально, но через CI что-то не хочет... может кто-то знает в чем проблема?!