select [name] from sys.columns where [object_id] = object_id('tbname') and column_id in (2,4)
select (select name from sys.columns where [object_id]=object_id('ruhuo') and column_id in (2,4)) from ruhuo 提示: 子查询返回的值不止一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时,这种情况是不允许的。应该怎么处理?
select * from gameitem where object_id('gameitem')=(select [name] from sys.columns where object_id = object_id('gameitem') and column_id=2) and object_id('gameitem')=(select [name] from sys.columns where object_id = object_id('gameitem') and column_id=4)这能得到你要的结果么
select [name]
from sys.columns
where [object_id] = object_id('tbname')
and column_id in (2,4)
提示:
子查询返回的值不止一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时,这种情况是不允许的。应该怎么处理?
from sys.columns
where object_id = object_id('gameitem')
and column_id=2) and
object_id('gameitem')=(select [name]
from sys.columns
where object_id = object_id('gameitem')
and column_id=4)这能得到你要的结果么