添加一个带有值的临时列 [英] add a temporary column with a value
本文介绍了添加一个带有值的临时列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个这样的选择语句
I have a select statement like this
select field1, field2
from table1
我想要的是拥有一个仅包含示例"值的新字段.
What I want is to have a newfield with only value "example".
newfield
在表中不存在,但是当我运行此查询时,它会使用示例字段的值创建一个虚拟列.
newfield
does not exist in the table, but when I run this query it kinda makes a virtual column with the values of example field.
推荐答案
select field1, field2, 'example' as TempField
from table1
这应该适用于不同的SQL实现.
This should work across different SQL implementations.
这篇关于添加一个带有值的临时列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文