select a=(select top 1 aa from [table] order by aa),b=(select aa from [table] where aa !=(select top 1 aa from [table] order by aa) and aa !=(select top 1 aa from [table] order by aa desc))
,c=(select top 1 aa from [table] order by aa desc)
from [table]
,c=(select top 1 aa from [table] order by aa desc)
from [table]
select a=(select top 1 aa from [table] order by aa),b=(select aa from [table] where aa !=(select top 1 aa from [table] order by aa) and aa !=(select top 1 aa from [table] order by aa desc))
,c=(select top 1 aa from [table] order by aa desc)
select @s=''
select @s=@s+','+ ''''+aaa+'''' from tb3
select @s=stuff(@s,1,1,'')
select @s
exec('select' +@s)
BBBB
CCCC
为同一行数据;为显示结果