Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Merge join with 2 keys as OR ?

  1. #1
    Join Date
    Aug 2009
    Posts
    14

    Default Merge join with 2 keys as OR ?

    Is it possible to do a merge join with an OR clause in the join.
    I have a table where one or the other number should match like in:

    Code:
    SELECT * FROM porg inner join hsf_modul ON (porg.pnr=hsf_modul.pnr OR porg.pnr=hsf_modul.oldpnr)

  2. #2
    Join Date
    Aug 2009
    Posts
    14

    Default

    Just for your info:
    Meanwhile i use a Database Join step to do this task.
    Dont know if this is "best practice", so this is the only remaining question.

    I previously used jitterbit, and use pentaho now since a week and have to say:
    Pentaho is getting better and better each day i use it. And thats not easy, as it was great after getting above the starting troubles.

  3. #3

    Default

    Conditional joins are typically considered a bad practice in SQL. You could easily re-write this as two left joins.
    Here is a link to a page that explains this situation and how to solve it (it is written for MS SQL Server, but the ideas apply to other RDMS):
    http://weblogs.sqlteam.com/jeffs/arc...nal-Joins.aspx

    Hope this helps,

    Carlos Castro

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 - 2019 Hitachi Vantara Corporation. All Rights Reserved.