如何在SQL查询中创建空白/硬编码列? [英] How can I create a blank/hardcoded column in a sql query?
本文介绍了如何在SQL查询中创建空白/硬编码列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个查询,列是一个硬编码的值不是从表,可以这样做吗?
I want have a query with a column that is a hardcoded value not from a table, can this be done? I need it basically as a placeholder that I am going to come back to later and fill in.
例如:
SELECT
hat,
shoe,
boat,
somevalue = 0 as placeholder
FROM
objects
然后我将循环遍历此查询并填写占位符
then I would loop through this query later and fill in the placeholder
在这个例子中someValue不是对象中的字段,我需要伪造它。我在coldfusion和使用两个数据源完成一个查询这样做。我尝试了space()函数,但无法让它工作。
in this example someValue is not a field in objects, I need to fake it. I am doing this in coldfusion and using two datasources to complete one query. I have tried the space() function but have been unable to get it to work.
谢谢。
推荐答案
SELECT
hat,
shoe,
boat,
0 as placeholder
FROM
objects
和'作为占位符
表示字符串。
这篇关于如何在SQL查询中创建空白/硬编码列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文