gpt4 book ai didi

sql - VALUES ( ) 语法的列别名

转载 作者:行者123 更新时间:2023-12-01 13:12:36 24 4
gpt4 key购买 nike

这是一些 SQL:

select T.*
FROM (
values ( '2014-05-30 17:26:32.749' , 'Casual shirt ' ) , ( '2014-05-30 17:26:32.749' , 'Casual shirt-White-Small ' ) , ( '2014-05-30 17:26:32.749' , 'Casual shirt-Blue-Medium ' ) , ( '2014-05-30 17:26:32.749' , 'Cords ' ) , ( '2014-05-30 17:26:32.749' , 'Bodysuit ' ) , ( '2014-05-30 17:26:32.749' , 'Cords-Black-29W x 28L ' ) , ( '2014-05-30 17:26:32.749' , 'Bodysuit-Black-Petit ' ) , ( '2014-05-30 17:26:32.749' , 'Cords-Brown-29W x 28L ' ) , ( '2014-05-30 17:26:32.749' , 'Classic pleated dress pant ' ) , ( '2014-05-30 17:26:32.749' , 'Classic pleated dress pant-Black-29W x 32L ' ) , ( '2014-05-30 17:26:32.749' , 'Dress shirt ' ) , ( '2014-05-30 17:26:32.749' , 'Dress shirt-White-15 ' ) , ( '2014-05-30 17:26:32.749' , 'Dress shirt-White-16 ' )
) T
;

它返回列“1”和“2”。如何更改它以返回命名列?不使用 sysdummy1 可以吗?

最佳答案

您可以将列名添加到T:

select T.*
FROM (values ( '2014-05-30 17:26:32.749' , 'Casual shirt ' ) ,
( '2014-05-30 17:26:32.749' , 'Casual shirt-White-Small ' ) ,
( '2014-05-30 17:26:32.749' , 'Casual shirt-Blue-Medium ' ) ,
( '2014-05-30 17:26:32.749' , 'Cords ' ) ,
( '2014-05-30 17:26:32.749' , 'Bodysuit ' ) ,
. . .
) T(col1, col2);

关于sql - VALUES ( ) 语法的列别名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24823634/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com