积极答复者
主查询中是否可以用数字引用相应的列??

问题
答案
-
SELECT [1],[2],[3],dbo.fnAbc(4) from(
selct * from myTest
)
表myTest有tID,tName,tA,tB,tC列
这样查询不可以?
1、不支持这样,在order by子句可以这样
2、变通一下
select [1],[2],[3],dbo.fnabc([4])
from
(
select tid as [1],tname as [2] ,ta as [3],tb as [4],tc as [5] from mytest
) a
如果这样可以接受 ,那把你的mytest做一个视图出来v_mytest,以后可以直接引用
More: blog.csdn.net/happyflystone- 已标记为答案 Hong-Gang Chen - MSFTModerator 2010年2月9日 4:04
全部回复
-
SELECT [1],[2],[3],dbo.fnAbc(4) from(
selct * from myTest
)
表myTest有tID,tName,tA,tB,tC列
这样查询不可以?
1、不支持这样,在order by子句可以这样
2、变通一下
select [1],[2],[3],dbo.fnabc([4])
from
(
select tid as [1],tname as [2] ,ta as [3],tb as [4],tc as [5] from mytest
) a
如果这样可以接受 ,那把你的mytest做一个视图出来v_mytest,以后可以直接引用
More: blog.csdn.net/happyflystone- 已标记为答案 Hong-Gang Chen - MSFTModerator 2010年2月9日 4:04
-
这种查询在pivot中是可以的
Memory all alone in the moonlight~My Blog in .NET~~~