来自sql的错误值太多了

时间:2017-02-23 16:40:54

标签: sql oracle

构件{ID,PASS,姓名,年龄,性别,EMAIL,SYSDATE} LOGINLOG {ID,SYS}

我想确保排除所有以前的loginlog数据

 select
  to_char(ll.SYS),
  mm.ID,
  count(*)
from 
    member mm, 
    loginlog ll 
where 
    mm.ID=ll.ID  
    and (
         (select 
                to_char(l.SYS),
                m.ID,
                count(*) 
                from member m , loginlog l
            where  l.ID = m.ID group by(to_char(l.SYS) , m.ID)
          ) != all(select to_char(ls.SYS), ls.ID ,ls.NUM from loginsave ls)
      ) 
group by(to_char(ll.SYS),mm.ID);

这给出了"

ORA-00913: too many values
00913. 00000 -  "too many values"
*Cause:    
*Action:
11, 11 column error 

1 个答案:

答案 0 :(得分:1)

这是你想要做的吗?

select to_char(ll.SYS), mm.ID, count(*)
from member mm join
     loginlog ll 
     on mm.ID = ll.ID  
group by to_char(ll.SYS), mm.ID
having (to_char(ll.SYS), mm.ID, count(*)) not in
           (select to_char(ls.SYS), ls.ID, ls.NUM from loginsave ls);