数据库表名 employee 结构如下;
id employeeid flag
1 x 0
2 x 1
3 y 0
4 z 1
5 m 0
6 n 0
查询出表中只有flag=0的employeeid,结果应该为:
id employeeid flag
3 y 0
5 m 0
6 n 0
请问大家 sql语句怎么写啊?效率越高越好
id employeeid flag
1 x 0
2 x 1
3 y 0
4 z 1
5 m 0
6 n 0
查询出表中只有flag=0的employeeid,结果应该为:
id employeeid flag
3 y 0
5 m 0
6 n 0
请问大家 sql语句怎么写啊?效率越高越好
解决方案 »
- oracle安装问题
- 这样写不对吗?(关于PL/SQL的)
- oracle物理恢复
- insert into select 要怎么用。报错显示ora-00947:没有足够的值
- 求救,数据库被误删除了,只剩一个数据文件了,有可能恢复么?
- 关于的utl_file.fopen错误!
- 555555555,sql语句求教 (不然晚上回不去了)
- 请教open_cursor 在线等待!!!
- (500分求助!)一些关于Oracle Form Developer的一些简单问题, 在线等待....
- 各位,哪有关于pro *c 方面的资料下, 谢谢先
- 关于外联的问题
- #######################一个SQL问题where a='A' and b='B' or c='C' 和where a='A' and (b='B' or c='C')结果一样吗?
from employee
where flag='0'
from employee
where id not in(select id from employee where flag<>0)
em.id,
em.exployeeID,
em.flag
from
employee em
where
not exists(
select
null
from
employee ep
where
ep.exployeeID = em.exployeeID
and ep.flag = 0)
from employee
where flag='0' and employeeid not in (select employeeid from employee where flag<>'0')
from employee emp
where not exists (select 1 from employee where employeeid=emp.employeeid and flag<>0);