Sign Up
Search
Options
search
Chat
Help
News
Log in
Not Logged in
Home
»
Boards
»
Stylus Studio Developer Network
»
XQuery Help and Discussion
»
How to join the two table using XQuery in YUKON?
Topic
Prev Topic
Next Topic
top
Subject:
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
Prev Topic
Next Topic
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 to Conference:
Select Conference
Stylus Studio Feature Requests
Stylus Studio Technical Forum
Website Feedback
XSLT Help and Discussion
XQuery Help and Discussion
Stylus Studio FAQs
Stylus Studio Code Samples & Utilities
Stylus Studio Announcements
go
Log In Options
Username:
Password:
Site Map
|
Privacy Policy
|
Terms of Use
|
Trademarks
Stylus Scoop XML Newsletter:
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.