oracle数据库中,两个字段之间包含的所有信息如何显示
比如:部门名称department是C,起始人员编号startno是A,截至人员编号endno是B字段A和B都是varchar2,字段A下是0100001,0100007...
比如:部门名称department是C,起始人员编号startno是A,截至人员编号endno是B
字段A和B都是varchar2,字段A下是0100001,0100007,0100011。。。字段B下是0100006,0100010,0100013,怎么写sql可以显示结果为:
C 0100001
C 0100002
C 0100003
C 0100004
C ........
C 0100006 展开
字段A和B都是varchar2,字段A下是0100001,0100007,0100011。。。字段B下是0100006,0100010,0100013,怎么写sql可以显示结果为:
C 0100001
C 0100002
C 0100003
C 0100004
C ........
C 0100006 展开
2个回答
展开全部
select department, A
from table
where A <all (select B from table where department='C') and department='C'
unoin
select department, B
from table
where B = (select min(B) from table where department='C') and department='C'
或
select department, A
from table
where A < (select min(B) from table where department='C') and department='C'
select department, B
from table
where B = (select min(B) from table where department='C') and department='C'
from table
where A <all (select B from table where department='C') and department='C'
unoin
select department, B
from table
where B = (select min(B) from table where department='C') and department='C'
或
select department, A
from table
where A < (select min(B) from table where department='C') and department='C'
select department, B
from table
where B = (select min(B) from table where department='C') and department='C'
更多追问追答
追问
不好意思,不对,查出来的结果还是只有A,不是A和B之间所有的,而且,如果只查一个部门的所有人员编号的话,完全可以使用excel查,目的是所有的部门下所有的员工号,请问是否有办法查出来
追答
你看看这个是你要的不:
select C, A
from table T1
where A <(select min(B) from table T2 where T2.C=T1.C)
unoin
select A, B
from table T1
where B = (select min(B) from table T2 where T2.C=T1.C)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询