XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
- XQuery Help and Discussion (2017)
-> + Issue with Processing Instruct... (2)
-> + problem converting json to XML... (2)
-> + Problem base64 decoding string... (3)
-> + Problems posting multipart for... (5)
-> + trouble with download of price... (2)
-> + Problem with http-post not bei... (3)
-> + path problem, xps_file:writeAl... (9)
-> + Xquery update support? (2)
-> + problem with Stylus studio try... (5)
-> + adding dtd reference to xml ou... (4)
-> + xquery escaping ambarsand when... (3)
-> + Whitespace problem when return... (5)
-> + Problem with namespace prefix ... (5)
-> - Sending via SFTP returns unexp... (1)
-> + Query and Sftp clent (4)
-> + xquery and try - catch (3)
-> + Query + ddtek:http-post optio... (5)
-> + Example files referenced in do... (3)
-> + Automatic Error Detection and ... (3)
-> + Working with result of ddtek:h... (2)
-- [1-20] [21-40] [41-60] Next
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Posttop
Apsar SultanaSubject: How to join the two table using XQuery in YUKON?
Author: Apsar Sultana
Date: 16 Sep 2005 09:13 AM
Hi,

I am new to XQuery. I created two typed XML. Now I want to join these two tables. The joining column is available as a tag in XML.

The crreated tables are

CREATE TABLE ProductDocs (
ID INT IDENTITY PRIMARY KEY,
ProductDoc XML(ProductSchema)
NOT NULL
)
GO

CREATE TABLE SupplierDocs (
ID INT IDENTITY PRIMARY KEY,
SupplierDoc XML(SupplierSchema)
NOT NULL
)
GO

Here the ProductSchema & SupplierSchema are schemas.

And the schema definitions are as follows

*****************ProductSchema*******************************

CREATE XML SCHEMA COLLECTION ProductSchema AS '
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.microsoft.com/schemas/adventureworks/
products"
xmlns:prod="http://www.microsoft.com/schemas/adventureworks/
products">
<xs:element name="Product">
<xs:complexType>
<xs:sequence>
<xs:element ref="prod:ProductID" />
<xs:element ref="prod:ProductName" />
<xs:element ref="prod:SupplierID" />
<xs:element ref="prod:CategoryID" />
<xs:element ref="prod:QuantityPerUnit" />
<xs:element ref="prod:UnitPrice" />
<xs:element ref="prod:UnitsInStock" />
<xs:element ref="prod:UnitsOnOrder" />
<xs:element ref="prod:ReorderLevel" />
<xs:element ref="prod:Discontinued" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ProductID" type="xs:integer" />
<xs:element name="ProductName" type="xs:string" />
<xs:element name="SupplierID" type="xs:integer" />
<xs:element name="CategoryID" type="xs:integer" />
<xs:element name="QuantityPerUnit" type="xs:string" />
<xs:element name="UnitPrice" type="xs:double" />
<xs:element name="UnitsInStock" type="xs:integer" />
<xs:element name="UnitsOnOrder" type="xs:integer" />
<xs:element name="ReorderLevel" type="xs:integer" />
<xs:element name="Discontinued" type="xs:boolean" />
</xs:schema>
'

*****************END of ProductSchema*******************************

*****************SupplierSchema*******************************

CREATE XML SCHEMA COLLECTION SupplierSchema AS '
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:prod="http://www.microsoft.com/schemas/DpMsxbrl/products"
targetNamespace="http://www.microsoft.com/schemas/DpMsxbrl/products">
<xsd:element name="Supplier">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="prod:ProductID" />
<xsd:element ref="prod:SupplierName" />
<xsd:element ref="prod:SupplierID" />
<xsd:element ref="prod:CategoryID" />
<xsd:element ref="prod:UnitPrice" />
<xsd:element ref="prod:UnitsInStock" />
<xsd:element ref="prod:UnitsOnOrder" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="ProductID" type="xsd:integer" />
<xsd:element name="SupplierName" type="xsd:string" />
<xsd:element name="SupplierID" type="xsd:integer" />
<xsd:element name="CategoryID" type="xsd:integer" />
<xsd:element name="UnitPrice" type="xsd:double" />
<xsd:element name="UnitsInStock" type="xsd:integer" />
<xsd:element name="UnitsOnOrder" type="xsd:integer" />
</xsd:schema>
'
***************** End of SupplierSchema*******************************

Now I want to join these two tables with the joining column "ProductID".

Can you please help me on this?

Regards,
Apsar

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.