需要查询更正

passwd -u

我想选择set <string> extensionsSet; std::ofstream fos(target,ios::binary); Poco::Zip::Compress c(fos,true); extensionsSet.insert("txt"); c.setStoreExtensions(extensionsSet);//set extensions List set <string> a = c.getStoreExtensions();//a contains 1 string which is txt Poco::File aFile(source); if (aFile.exists()) { if (aFile.isDirectory()) { Poco::Path sourceDir(source); sourceDir.makeDirectory(); c.addRecursive(sourceDir,Poco::Zip::ZipCommon::Compressionmethod::CM_DEflaTE,Poco::Zip::ZipCommon::CL_NORMAL,false); } else if (aFile.isFile()) { Poco::Path p(aFile.path()); c.addFile(p,p.getFileName(),Poco::Zip::ZipCommon::Compressionmethod::CM_AUTO,Poco::Zip::ZipCommon::CL_NORMAL); } } else { _log.EndMethod(); throw new FileNotFoundException("File Not Found"); } c.close(); // MUST be done to finalize the Zip file fos.close(); 作为select stdcode,name,degree_code,phone,startsemester,endsemester from ( select distinct stdcode as stdcode,name as name,degree_code as degree_code,phone as phone,( SELECT sem_code FROM V_ALLSTUDATA b WHERE a.name = b.name and a.stdcode= b.stdcode and a.degree_code=b.degree_code and a.phone=b.phone AND startsem=(select min(startsem) from V_ALLSTUDATA b) ) as startsemester,( SELECT sem_code FROM V_ALLSTUDATA b WHERE a.name = b.name and a.stdcode= b.stdcode and a.degree_code=b.degree_code and a.phone=b.phone AND startsem=(select max(startsem) from V_ALLSTUDATA a) ) as endsemester from V_ALLSTUDATA a ); sem_code作为startsem_code

如何解决此错误?

ORA-01427:单行子查询返回多个行
01427. 00000-“单行子查询返回多个行”
*原因:
*动作:

DATA ATTACHED HERE YOU CAN DOWNLOAD FOR YOU CONVENIENCE

everaining 回答:需要查询更正

由于子查询有一个明确的要求,即它们必须与min(startsem)max(startsem)匹配,因此我认为子查询将仅返回一个值。但是,它们 可能 返回多个具有相同值的实例。

为防止这种情况,我认为您想向两个子查询中添加distinct,如下所示:

            (select distinct sem_code
              from V_ALLSTUDATA b
               where  a.name = b.name and a.stdcode= b.stdcode and a.degree_code=b.degree_code and a.phone=b.phone
              and endsem=(select max(startsem) from V_ALLSTUDATA a)

            ) as endsemester
,

您在单个查询中有多行,所以我认为您将使用rownum。 所以尝试下面的查询

medecin
,

问题在一个返回SELECTstartsemester值的endsemester语句中(或两个)。例如:

(SELECT sem_code
 FROM V_ALLSTUDATA b
 WHERE     a.name = b.name
   AND a.stdcode = b.stdcode
   AND a.degree_code = b.degree_code
   AND a.phone = b.phone
   AND startsem = (SELECT MIN (startsem)
                   FROM V_ALLSTUDATA b)) AS startsemester

绝不能返回多个值。由于我们没有您的数据,因此无法回答为什么您获得too_many_rows。有几种出路,例如

  • 使用汇总中的一种,例如MAX,例如select max(sem_code) from ...
  • 查看distinct是否有帮助,例如select distinct sem_code from ...
  • rownum子句中加入where,例如... and rownum = 1

但是-从我的角度来看-您应该研究导致错误的原因并进行适当修复。也许您错过了where子句中的其他条件;谁知道?我们可能不会。

,
     with tt AS
    ( select    f.stdcode,f.name,f.degree_code,f.phone,MIN(f.startsem)as startsemdate,MAX(f.startsem)as endsemedate
    FROM V_GRADUATED f
    GROUP BY 
      f.stdcode,f.phone)
    select    tt.stdcode,tt.name,tt.degree_code,tt.phone,(select sem_code 
             from v_graduated a
            where a.stdcode=tt.stdcode 
             and a.startsem=tt.startsemdate) startsemester,(select sem_code
             from v_graduated a
             where a.stdcode=tt.stdcode 
            and a.startsem=tt.endsemedate) endsemester
      from tt

这就是我想要的.......>这是正确的答案

enter image description here

本文链接:https://www.f2er.com/2832247.html

大家都在问