I want to get all customers whose salary > 2000. the query seems to be simple but the problem lies when I want to return multiple attributes.
For example the query should return customer name, customer address, and that whole xml instance. I dont know how to achieve this in xquery.
Subject:Filtering multiple values from xquery Author:kensky schulz Date:26 Apr 2006 10:12 AM
Thanks for reply.
Here in your XQuery it will return three different attributes. name, salary etc. My question is I want to return $richCustomer/name, $richCustomer/salary, and $richCustomer itself. This customer example is simple but what if we have very complex document.
Subject:Filtering multiple values from xquery Author:Minollo I. Date:26 Apr 2006 10:25 AM
I'm not sure I understand your question; the example in question shows you how you can copy elements to the result sequence. Copying elements (like $richCustomer, for example) will copy its subelements recursively, if that's what you need.
I got the solution. Yes I wanted to have contents of $richCustomer along with its children.
So here is the example using $c in place of $richCustomer,
for $c in collection("customerContainer") where $c//salary > 2000 return <cname>{$c//cname}</cname>,<salary>{$c//salary}</salary>,<wholeDoc>{$c}</wholeDoc>
in fact your query gave me the idea to solve this issue.