if exists (select 1 from sysobjects where name='test1')
drop table test1
go
create table test1
(
a varchar(10),
b int
)
insert into test1 select '好','1 '
insert into test1 select '很好','2 '
insert into test1 select '非常好','3 '
SELECT V1.a, V2.b
FROM (SELECT TOP (1) a
FROM dbo.test1) AS V1 CROSS JOIN
(SELECT SUM(b) AS b
FROM dbo.test1 AS test1_1) AS V2
结果:
a b
好 6
温馨提示:答案为网友推荐,仅供参考