且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

DB2 AS/400 iseries在where子句中使用别名

更新时间:2023-02-04 23:23:00

如果您真的想在 WHERE 中使用别名,而不是列本身,则可以使用派生表来实现:

If you really want to use alias in WHERE, not the column itself, you can do it with derived table :

SELECT a.* 
FROM
(
  SELECT lmITNO AS Item_Number, lmBANO AS Lot, lmSTAS AS Status, 
  lmRORN AS Order_Number 
  FROM MVXJDTA.MILOMA 
) a
WHERE a.Status = 'CCC'
....