怎么写这样的主从表的SQL语句? 主表字段:编号、姓名、学生类型其中一条记录:001、张三、011从表字段:编号、学生类型其中一条记录:011、本科怎么查询出这样格式的记录:001、张三、本科就是主表存的学生类型的编号转换成具体的类型。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select 主表.编号,主表.姓名,从表.学生类型 from 主表,从表where 主表.编号 = 从表.编号--and ... select stuNo, stuName, stuTypeName from student, studentTypewhere student.stuTypeNo = studentType.stuTypeNoand student.stuNo = '001'; create table student( stuNo char(3) not null, stuName varchar(32), stuTypeNo char(3),primary key (stuNo));create table studentType( stuTypeNo char(3) not null, stuTypeName varchar(32),primary key (stuTypeNo)); SELECT [a].[编号],[a].[姓名],[b].[学生类型] FROM [主表] a , [从表] b WHERE [a].[编号] = [b].[编号] select 主表.编号,主表.姓名,从表.学生类型 where 主表.编号=从表.编号试一试,应该可以的 select t1.编号,t1.姓名,t2.学生类型 from 主表 as t1 inner join 从表 as t2 on t2.编号 = t1.编号 用VC编写的串口通信程序,总是数据接收不全,这是为什么啊 3D引擎开发 问各位达人一个ISAPI筛选器未加载的问题 为什么会error LNK2019: 无法解析的外部符号 MFC程序与Internet上的服务器(WEB系统)进行资料交互是不是WinInet编程? 如果采用静态调用,直接更改Dll名称后,而不是重新编译,如何还能用静态调用的方式使用? 关于STL里的set模板的问题 怎么获得特殊键的扫描码 一个简单问题(送分题)!!!!!! 数据压缩 网页的链接捕获的问题 分割窗口的信息同步问题
where 主表.编号 = 从表.编号
--and ...
where student.stuTypeNo = studentType.stuTypeNo
and student.stuNo = '001';
(
stuNo char(3) not null,
stuName varchar(32),
stuTypeNo char(3),
primary key (stuNo)
);create table studentType
(
stuTypeNo char(3) not null,
stuTypeName varchar(32),
primary key (stuTypeNo)
);
试一试,应该可以的