Skip to Main Content
IBM Power Ideas Portal


This portal is to open public enhancement requests against IBM Power Systems products, including IBM i. To view all of your ideas submitted to IBM, create and manage groups of Ideas, or create an idea explicitly set to be either visible by all (public) or visible only to you and IBM (private), use the IBM Unified Ideas Portal (https://ideas.ibm.com).


Shape the future of IBM!

We invite you to shape the future of IBM, including product roadmaps, by submitting ideas that matter to you the most. Here's how it works:

Search existing ideas

Start by searching and reviewing ideas and requests to enhance a product or service. Take a look at ideas others have posted, and add a comment, vote, or subscribe to updates on them if they matter to you. If you can't find what you are looking for,

Post your ideas
  1. Post an idea.

  2. Get feedback from the IBM team and other customers to refine your idea.

  3. Follow the idea through the IBM Ideas process.


Specific links you will want to bookmark for future use

Welcome to the IBM Ideas Portal (https://www.ibm.com/ideas) - Use this site to find out additional information and details about the IBM Ideas process and statuses.

IBM Unified Ideas Portal (https://ideas.ibm.com) - Use this site to view all of your ideas, create new ideas for any IBM product, or search for ideas across all of IBM.

ideasibm@us.ibm.com - Use this email to suggest enhancements to the Ideas process or request help from IBM for submitting your Ideas.

Status Not under consideration
Workspace IBM i
Categories Db2 for i
Created by Guest
Created on Sep 12, 2019

Nested calculated columns in SQL

Today you are not allowed to use nested result columns in calculations and expressions.

The work around is to rewrite the statement to use common table expression. This, however, removes the focus from what need to be done - just to satisfy the nature of SQL.


Use Case:

The following SQL construction is not allowed:

Select
price * stockCnt as stockValue,
stockValue / 7.35 as stockValueEUR,
product.*
from product
order by stockValueEUR

This examples show that the stock value in EUR is calculated based on the stock value that again is calculated on price and stock in the table.

The work around is to rewrite the statement to use CTE like this:

with product1 as (
Select
price * stockCnt as stockValue,
product.*
from product
) , product2 as (
select
stockValue / 7.35 as stockValueEUR,
product1.*
from product1
)
Select * from product2
order by stockValueEUR;


Idea priority Medium
  • Guest
    Reply
    |
    Mar 23, 2021

    IBM does not intend to provide a solution to this request at this time, so it is being closed.

    Nested column references are not part of the SQL standard and have not been implemented by Db2 LUW or Db2 for Z. Using common table expressions is recommended to avoid the same calculation in multiple places. This solution can be used for the same expression used anywhere in the query, not just in the select list.

  • Guest
    Reply
    |
    Aug 24, 2020

    The CEAC has reviewed this requirement and recommends that IBM view this as a MEDIUM priority requirement that should be addressed.

    Background: The COMMON Europe Advisory Council (CEAC) members have a broad range of experience in working with small and medium-sized IBM i customers. CEAC has a crucial role in working with IBM i development to help assess the value and impact of individual RFEs on the broader IBM i community and has therefore reviewed your RFE.

    To find out how CEAC help to shape the future of IBM i, see CEAC @ ibm.biz/BdYSYj and the article "The Five Hottest IBM i RFEs Of The Quarter" at ibm.biz/BdYSZT

    Therese Eaton – CEAC Program Manager, IBM

  • Guest
    Reply
    |
    Nov 5, 2019

    I went on and tested this example on ACS and it functions as requested. How is this request being run?