DB2 SQL选择All with Columns As

jal*_*095 1 sql db2 ibm-midrange

我正在使用DB2上的一些SQL查询.是否可以选择表中的所有列,还可以在该select语句中使用"as"关键字指定某些条件?例如,此查询是否可行:

select
  *,
  col1 + col2 as sum1,
  col3 - col4 as dif1
from 
  table;
Run Code Online (Sandbox Code Playgroud)

每当我尝试这个,我得到SQL0104错误,它说"令牌,无效.有效令牌:FROM INTO".

谢谢您的帮助.

编辑:此查询在AS400上的SQLRPLGE程序中运行.

小智 8

将表别名放在*前面.所以:

select
  t.*,
  col1 + col2 as sum1,
  col3 - col4 as dif1
from 
  table t;
Run Code Online (Sandbox Code Playgroud)