DB2 SQL 全选,列为 [英] DB2 SQL Select All With Columns As
本文介绍了DB2 SQL 全选,列为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在处理 DB2 上的一些 SQL 查询.是否可以选择表中的所有列并在该选择语句中使用as"关键字指定某些条件?例如,这个查询是否可行:
I am working with some SQL queries on DB2. Is it possible to select all the columns in a table and also specify certain conditions using the "as" keyword within that select statement? For example, is this query possible:
select
*,
col1 + col2 as sum1,
col3 - col4 as dif1
from
table;
每当我尝试这样做时,我都会收到 SQL0104 错误,它说令牌,无效.有效令牌:FROM INTO".
Whenever I attempt this, I am getting the SQL0104 error and it is saying "Token , was not valid. Valid tokens: FROM INTO".
感谢您的帮助.
此查询在 AS400 上的 SQLRPGLE 程序中运行.
This query is running inside an SQLRPGLE program on an AS400.
推荐答案
把你的表别名放在*.所以:
Put your table alias in front of the *. So:
select
t.*,
col1 + col2 as sum1,
col3 - col4 as dif1
from
table t;
这篇关于DB2 SQL 全选,列为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文