SQL每日一题(20230619)

2024-04-24 18:06:51 浏览数 (1)

有如下一张表G0619

希望得到如下结果:

即对相同的No进行转置

测试数据

代码语言:javascript复制
CREATE TABLE G0619 (
No INT,
NAME NVARCHAR(20),
age INT)

INSERT INTO G0619 VALUES (1,'张三','18');
INSERT INTO G0619 VALUES (1,'李四','17');
INSERT INTO G0619 VALUES (1,'王五','23');
INSERT INTO G0619 VALUES (1,'赵六','40');
INSERT INTO G0619 VALUES (2,'Tom','17');
INSERT INTO G0619 VALUES (3,'Bob','19');
INSERT INTO G0619 VALUES (3,'Tony','36');
INSERT INTO G0619 VALUES (3,'Petter','25');

0 人点赞