① 例举几条多表查询sql语句
1.select a.学号,a.姓名,b.学籍号,a.性别,a.民族,a.身份证号,a.联系电话
from 学生表 a, 注册表 b
2.select count (*) [注册人数]from 注册表
where 注册时间='2010-10-20'(select 专业代码,专业名称,总金额 from 专业表,注册表,收据表
where 注册时间='2010-10-20')
3.select a.所属院系,b.性别,c.房间号,床位状态
from 专业表 a, 学生表 b,房间表,床位表 c
where 床位状态 = '空位'
② 求一条多表查询的sql语句
select t1.*,t2.Closes from StokJgxw t1,StockDaily t2
where t1.StockCode=t2.StockCode
and t1.StockTime>'2012-04-01'
and t1.StockTime<'2012-07-01'
③ SQL多表查询语句有哪些
不明白你的意思
select * from 表1,表2,....
where
select * from 表1 join 表1 on ..
还有 left join ,right join ,full join,
不知道是不是指这个
④ sql语句多表查询
select aa.name 姓名,aa.type 人员类别,nvl(b.value,0) 提成,nvl(b1.value) 基本工资 (select a.name name,(case when a.stafftype=1 then 装卸工 when a.stafftype=2 then 维修工
else 职员 end ) type,a.id aid,c.projectsname pname from ba_staff_info a ,wage_project c where a.userid=c.userid) aa
left join wage_info b on b.staffid=aa.aid and aa.pname='提成'
left join wage_info b1 on b1.staffid=aa.aid and aa.pname='基本工资'
.......
下面以此类推吧,我的思想是纵表转横表,希望对你有帮助,谢谢!
⑤ SQL语句实现多表查询
select a.keb001,a.keb003,a.keb004,a.keb007,a.keb016,b.kea003,c.raa001,d.qka005,d.aka006
FROM JSKKEB a, JSKKEA b,SGMRAA c,SGMQKA d
WHERE a.keb001=b.kea001 and a.keb016=c.raa011 and c.raa001=d.qka004
and b.kea003 = 你的日期条件(这里很奇怪,我加上去的条件无法更新上去,抱歉。一定要注意日期格式)
这是oracle数据库的sql语法,请根据你自己数据库的语法稍加修改。
如果a,b,c,d别名不行,可以把别名去掉,前缀直接用表名。
⑥ sql如何多表查询语句
其实多表查询,用到的关键字,就是像inner join,left join,right join 之类的,根据具本情况,选择自已适合的连接语句。
举个例子吧
select a.studnt_sno,b.sno,c.grade from studnt as a inner join depart as b on a.sno=b.sno left join sc as c on b.cno=c.no
⑦ SQL语句多表查询
1、select *
from sailors where sid in (select sid from reserves where bid='105')
2、select *
from sailors where sid in (select sid from reserves) and age>18
3、select t1.sid,t1.sname
from sailors t1, reserves t2
where t1.sid=t2.sid
group by t1.sid,t1.sname
having count(*)>=2
⑧ SQL多表查询语句怎么写
SQL多表查询语句的步骤如下:
我们需要准备的材料分别是:电脑、sql查询器。
1、首先,打开sql查询器,连接上相应的数据库表,例如m1表和m2表。
⑨ SQL 语句多表查询
不知道你是要总个数还是数的总和
如果是总和select a.Username,sum(a.Number) from a jion b on a.UserName=b.UserName group by a.Username
如果是总个数selecta.Username, count(a.Number) from a jion b on a.UserName=b.UserName group by a.Username