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 May 4, 2022

Support subselect and subquery in the SQL join-condition

Please provide an extended JOIN syntax to support EXISTS (subquery) or IN (subquery) in the join condition.


This will facilitate JOINS where NULL values are involved and should be kept.

for example:

with p(rel1id, a1, a2, a3, x) as (
values
(1, 'yes', 4, 56, 'blue'),
(2, 'yes', 4, 56, 'red'),
(3, 'no', 4, 56, 'white'),
(4, 'no', 4, NULL, 'green')
),
q(rel2id, a1, a2, a3, y) as (
values
(5, 'yes', 4, 56, 'cats'),
(6, 'no', 4, NULL, 'dog')
)
select p.*, q.rel2id, q.y
from p join q on exists (values (p.a1, p.a2, p.a3)
intersect
values (q.a1, q.a2, q.a3))
;

Expected Result:

REL1ID

A1

A2

A3

X

REL2ID

Y

1

yes

4

56

blue

5

cats

2

yes

4

56

red

5

cats

4

no

4


green

6

dog



Idea priority Medium
  • Guest
    Reply
    |
    Jun 3, 2022
    IBM does not intend to provide a solution to this request at this time, so it is being closed.

    While we agree this could be a useful addition to SQL, the database team has many higher priority items to work on right now. This request is unlikely to be implemented in the next several years.

    Although we are declining the request, we are keeping it on an internal list so we can reconsider it in the future.
  • Guest
    Reply
    |
    May 11, 2022

    This case could be solved by using "is not distinct from".

    with p(rel1id, a1, a2, a3, x) as (
    values
    (1, 'yes', 4, 56, 'blue'),
    (2, 'yes', 4, 56, 'red'),
    (3, 'no', 4, 56, 'white'),
    (4, 'no', 4, NULL, 'green')
    ),
    q(rel2id, a1, a2, a3, y) as (
    values
    (5, 'yes', 4, 56, 'cats'),
    (6, 'no', 4, NULL, 'dog')
    )
    select p.*, q.rel2id, q.y
    from p join q on
    p.a1 is not distinct from q.a1 and
    p.a2 is not distinct from q.a2 and
    p.a3 is not distinct from q.a3
    ;