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
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext 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

 
Go to previous topicPrev TopicGo to next topicNext Topic
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.