Select c.tagdescription,a.tagvalue,a.time
from a表
join b表 on a.tagindex = b.tagindex
join c表 on b.tagname = c.tagname
from a表
join b表 on a.tagindex = b.tagindex
join c表 on b.tagname = c.tagname
解决方案 »
- 数据库数据插入的问题
- 如何求周一至周日作为一周?但week是周日至周六的。请赐教!!
- 急:求取字符串的函数
- 遇到麻烦了,高手低手都来瞧瞧啊!
- 动态语句问题请教
- 要死人了法将架构脚本“\\SERVER05-10\D$\wwww\huaxuan\ftp\SERVER05-10_shop_sshop\200907091017
- 继续高分求解DBCC DBREINDEX
- 将txt导入到mssql如何处理重复数据?
- 各位高手,现在有一个关SQL SERVER2000 数据库的问题,请帮忙解决!先谢了!
- SQL SERVER 7.0 server 安装问题
- 触发器是怎么回事?
- 如何获得数据库创建时设定的大小?
select c.description,a.tagvalue,a.time
from a表
inner join b表 on a.tagindex=b.tagindex
inner join b.tagname=c.tagname
为什么得不到这个结果呢?
Create table a表(tagindex int,tagvalue int,time char(5))
insert a表 select 1,3,'11:30'
union all select 2,7,'11:30'
union all select 1,4,'11:40'
union all select 2,8,'11:40'Create table b表(tagname char(2),tagindex int)
insert b表 select 'kk',1
union all select 'ss',2
Create table c表(tagname char(2),tagdescription varchar(10))
insert c表 select 'kk','液位'
union all select 'ss','压力'Select c.tagdescription,a.tagvalue,a.time
from a表 a
join b表 b on a.tagindex = b.tagindex
join c表 c on b.tagname = c.tagname
Select c.tagdescription,a.tagvalue,a.time
from a表 a
join b表 b on a.tagindex = b.tagindex
join c表 c on b.tagname = c.tagnametagdescription tagvalue time
-------------- ----------- -----
液位 3 11:30
压力 7 11:30
液位 4 11:40
压力 8 11:40(所影响的行数为 4 行)