[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Article posted on Experts Exchange about XQuery outer joins

Martin Probst mail at martin-probst.com
Mon Jun 21 20:06:23 PDT 2010


  Article posted on Experts Exchange about XQuery 
	outer joins
What about this?

<results>
{
for $main in doc("C:\Xquery Outer Joins\tblMain.xml")/dataroot/tblMain
let $subs := doc("C:\Xquery Outer
Joins\tblSub.xml")/dataroot/tblSub[MainID=$main/MainID]/Sub
let $actual := if ($subs) then $subs else '-'
return
<row>
    <MainID>{data($main/MainID)}</MainID>
    <MainText>{data($main/MainText)}</MainText>
    {
      for $sub in $actual return <Sub>{data($sub)}</Sub>
    }
</row>
}
</results>

You can simply substitute a single '-' for an empty list of "subs".

Regards,
Martin

On Mon, Jun 21, 2010 at 18:29, Andrew Webster <http://x-query.com/mailman/listinfo/talk> wrote:
> Hi all,
>
> I'm after some feedback on an article I've posted at How to write an XQuery
> that is the exact equivalent of a SQL OUTER JOIN
>
> It would be great to find out if I've done something useful, or if I've
> managed to miss something simple that would have achieved the same result!
>
> Regards,
>
> Andrew Webster
>
> Cell: (205) 706-3371
> Fax: (866) 567-8013
> Skype: andrewmwebster
>
> Check Tungle for my free/busy info
> Want a personal email like mine? Click here
>
>
>
> _______________________________________________
> http://x-query.com/mailman/listinfo/talk
> http://x-query.com/mailman/listinfo/talk
>



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.