Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Join tables with a common where condition

  1. #1

    Default Join tables with a common where condition

    I have two tables in two different environments. I need to simulate using Kettle a query like the following one:

    Code:
    select *
    from t1
    left join t2
    on t1.a=t2.a
    where t1.b="VALUE1" OR t2.c="VALUE2"
    I've tried with two table input with the following queries:

    Code:
    select *
    from t1
    where t1.b="VALUE1"
    Code:
    select *
    from t2
    where t2.c="VALUE2"
    And then merging the data flows, but of course I miss data.

    Have you any idea about how to solve this problem?

    Thank you!
    Last edited by uilli; 11-30-2018 at 05:08 AM.

  2. #2
    Join Date
    Nov 2009
    Posts
    672

    Default

    Why are you missing data? With the merge join step you can also use a left join

  3. #3

    Default

    Sorry, I've modified my query. The where condition contains an OR, not an AND.

  4. #4

    Default

    Quote Originally Posted by johanhammink View Post
    Why are you missing data? With the merge join step you can also use a left join
    The first table input retrieve the data verifying the first part of the where condition. The second one retrieves the one veryfying the second part. I can perform I left join using the Merg Join step, but I cannot simulate the whole WHERE condition.

    In other words, the first table input retrieves from t1 just a subset of the data I need, the ones satisfying t1.b="VALUE1", but doesn't the ones satisfying t2.b="VALUE2".

  5. #5
    Join Date
    May 2016
    Posts
    258

    Default

    Use the filter step in a transformation to set up the WHERE with an OR condition.
    OS: Ubuntu 16.04 64 bits
    Java: Openjdk 1.8.0_131
    Pentaho 6.1 CE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2017 Pentaho Corporation. All Rights Reserved.