如何在 sql 查询中创建空白/硬编码列? [英] How can I create a blank/hardcoded column in a sql query?

查看:12
本文介绍了如何在 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 不是对象中的字段,我需要伪造它.我在冷融合中这样做并使用两个数据源来完成一个查询.我已经尝试了 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆