@H_502_3@update student s1 set s1.delay = (select (date1 -date2) from cource c where ****c.id = c1.id****(II) and c.value ='On' and c.Act_id = select max(Act_id) from cource c2 where c2.Id = C.id and c2.value ='On') ****from student s1 , cource c1****(I) where c1.id = s1.id and c1.value ='On' and s1.status = 'active' and s1.currentprofile = s1.prevProfile;
更新时,我们可以看到两个主要条件,
首先,如果您看到这一部分,请@H_502_3@****from student s1 , cource c1****(I)确保仅更新@H_502_3@student表中具有匹配项@H_502_3@id的@H_502_3@cource表中的行以及更多条件,并且由于Oracle不允许直接在语句的@H_502_3@from子句中进行此类检查@H_502_3@update,因此可以用@H_502_3@exists下面的Oracle查询中可以看到的子句代替。
其次,部分@H_502_3@****c.id = c1.id****(II)上面的Sybase查询确保它进一步只是获取数据的@H_502_3@setBY子句@H_502_3@co-relate对@H_502_3@ids我们的第一步,并为甲骨文这个发现,我们需要用它也被更新,即实际的表来代替@H_502_3@student,因为我们已经确保与@H_502_3@exists在第一个步骤是什么@H_502_3@ids,必须更新。
@H_502_3@update student s1 set s1.delay = (select (date1 - date2) from cource c where c.id = s1.id and c.value ='On' and c.act_id = select max(act_id) from cource c2 where c2.Id = c.id and c2.value ='On') from student s1 where s1.status = 'active' and s1.currentprofile = s1.prevprofile and exists (select 1 from cource c1 where c1.id = s1.id and c1.value ='On');