|
[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 joinsMartin Probst mail at martin-probst.comMon Jun 21 20:06:23 PDT 2010
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






