webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Tamino XQuery Outer Joins

    Posted Mon December 29, 2003 11:51 PM

    I am familiar typical with XQuery joins in Tamino like:

    for $x in input()\employee,
    $y in input()\doc
    
    where $x/@employee_id = $y/@employee_id
    </pre><BR><BR>But how would you do something like this SQL equivalent of an outer join:<BR><pre class="ip-ubbcode-code-pre">
    select * from employee e
    left outer join doc d on e.employeeid = d.employeeid

    #webMethods
    #API-Management
    #Tamino


  • 2.  RE: Tamino XQuery Outer Joins

    Posted Mon December 29, 2003 11:54 PM

    Just for clarity it is my understanding that the XQuery sample I provided is a inner join (no nulls on either side of the join).


    #API-Management
    #webMethods
    #Tamino


  • 3.  RE: Tamino XQuery Outer Joins

    Posted Tue December 30, 2003 10:49 AM

    Hi Larry,

    you do this by nesting fLWR into the return clause, e.g.
    for $x in input()/employee
    return

    {$x}
    {for $y in input()/doc
    where $x/@employee_id = $y/@employee_id
    return $y}


    #webMethods
    #Tamino
    #API-Management


  • 4.  RE: Tamino XQuery Outer Joins

    Posted Wed December 31, 2003 12:59 PM

    It depends rather on the output that you want to produce. Typically, I would expect to see something like this:

    for $e in input()//employee
    return

    { $e/*,
    let $d = input()//dept[@dept-nr = $e/dept-nr]
    return if (empty($d)) then () else {$d}
    }


    The SQL outer join produces a table in which unavailable data is replaced by null values. Typically with XML the equivalent will be to produce elements with a variable number of child elements.

    Michael Kay


    #Tamino
    #API-Management
    #webMethods


  • 5.  RE: Tamino XQuery Outer Joins

    Posted Fri January 02, 2004 06:09 PM

    Thanks Gentlemen!
    Both of your responses were helpfull in my efforts!


    #Tamino
    #webMethods
    #API-Management