tabel1: dep,pro; table2:pro,x,y,...; select b.pro,b.x,b.y,... from table1 a,table2 b where a.pro=b.pro and a.dep='计算机学院'
zhenyukeji(何处是我家) (+)是什么意思啊?
select * from jy_jyltj where code_zyxydz.szxy='电子信息工程学院' and CODE_ZYXYDZ.zymc=jy_jyltj.专业名称; 这个sql语句怎么会有错了?错误是没有zymc这个字段,但code_zyxydz表里面肯定是有这个字段的,我的数据库是oracle。
select * from table2 where 专业 in (select 专业 from table1 where 学院 = 计算机学院)
select a.* from jy_jyltj a,code_zyxydz b where b.szxy='电子信息工程学院' and b.zymc=a.专业名称
select * from table2 where 专业 in (select 专业 from table1 where 学院 = '计算机学院')
如果不好理解,你可以这么做: 1、获得属于计算机学院的所有专业: SELECT 专业 FROM your_table WHERE 学院 = '计算机'; 2、既然找到了专业,那么从另一个表中查找这些专业的信息就很容易了。 总而言之,就是要分析问题,找到目标。
注意字段使用char型,不要使用varchar2型,varchar2型使用=比较有些问题
select * from table2 where 专业 in (select 专业 from table1 where 学院 = '计算机学院') / or select b.* from table1 a,table2 b where a.专业=b.专业 and a.学院 = '计算机学院' /
select * from table1,table2 where table1.专业=table2.专业 and table1.学院='计算机学院'
select A.学院,A.专业,B.其他信息字段 from 第一个表 A,第二ge表 B where A.专业=B。专业 and A.学院= 条件(计算机学院) group by A。学院,A。专业
table2:pro,x,y,...;
select b.pro,b.x,b.y,... from table1 a,table2 b where a.pro=b.pro and a.dep='计算机学院'
(+)是什么意思啊?
这个sql语句怎么会有错了?错误是没有zymc这个字段,但code_zyxydz表里面肯定是有这个字段的,我的数据库是oracle。
where b.szxy='电子信息工程学院' and b.zymc=a.专业名称
1、获得属于计算机学院的所有专业:
SELECT 专业 FROM your_table WHERE 学院 = '计算机';
2、既然找到了专业,那么从另一个表中查找这些专业的信息就很容易了。
总而言之,就是要分析问题,找到目标。
/
or
select b.* from table1 a,table2 b
where a.专业=b.专业 and a.学院 = '计算机学院'
/
where table1.专业=table2.专业 and table1.学院='计算机学院'
from 第一个表 A,第二ge表 B
where A.专业=B。专业
and A.学院= 条件(计算机学院)
group by A。学院,A。专业