Let me first say hello, not been here before, looks likea nice site.
Down to Business :twisted:
I need some help, i have two SQL statements which i need to change into XQuery. I have had some limited sucess with them, but no really luck with getting them done.
Oh and im running the XQuery statements using the Northwinds Database Exported in XML format.
The First SQL Statement is :
SELECT count(*)
FROM shippers
LEFT join orders ON orders.shipvia = shippers.shipperid
WHERE shippers.companyname = ‘United Package’
I have managed to get the Join to work in XQuery using:
xquery version “1.0”;
{
for $x in doc(“Orders.xml”)/dataroot/Orders
for $y in doc(“Shippers.xml”)/dataroot/Shippers
where $x/ShipVia = $y/ShipperID and $y/CompanyName = “United Package”
return
{($x/OrderID)}{($y/CompanyName)}}
However not being able to impliment the Count()
Any ideas or fixed modified code would be greatly recieved.
The second SQL statement needing changing is:
SELECT firstname, lastname, hiredate
FROM employees
WHERE hiredate > ‘12/31/92’ AND hiredate < ‘01/01/94’
Now with this i have produced :
xquery version “1.0”;
{
for $x in doc(“Employees.xml”)/dataroot/Employees
where $x/HireDate>= "1992-07-06" and $x/HireDate <= "1993-15-12"
return <Hired> {($x/FirstName)} {($x/LastName)} {($x/HireDate)}</Hired>
}
With this i get an error about DateTime ?
ANY help with either of these would be amazing
Thanks for Reading and taking the time to help me.
Kind Regards
Dave