[xquery-talk] Where Clause and XDT:Untyped Issues
Torsten Grust
grust at in.tum.de
Sat Feb 2 13:41:50 PST 2008
Hi Alice,
it might very well be that
where contains($ad/head,'Baseball')
should be replaced by
where contains($doc/head,'Baseball')
($ad is invariant in the loop and thus makes for a questionable
filter criterion). It is hard to tell, though: as Mike already
said, you didn't post (a sketch of) your data.
Cheers,
--Torsten
On Feb 1, 2008, at 23:31, Wei, Alice J. wrote:
> Hi,
>
> I believe I have been passing this question through, but I think
> my main question about not been able to put in a where clause in my
> XQuery after my second let statement has been declared. In return, I
> receive all retrieved results is the issue.
>
> The code below has been modified from one of the members’
> inspirations. Apparently, no matter what I do, it appears that the
> where clause in the $sorted_result has never been taken into the
> output generation. When executed the script, it gives me back
> everything, whether or not the word “baseball” was in the head. I
> have 197 distinct values in my list.
>
> let $ad := fn:collection("xmldb:exist://db/my")//ad
> let $sorted_result:=
> for $doc in distinct-values($ad)
> where contains($ad/head,'Baseball')
> order by $doc
> return $doc
> for $r at $count in $sorted_result
> let $nodes := $ad[. = $r]
> return
> <ad>
> <statistics>
> Showing Result: {$count} / {count($sorted_result)}
> </statistics>
> {$nodes}
> </ad>
>
> What I want here is just something simple, I want to be able to put
> in some form of where clause so I can eliminate more of my current
> result output. [...]
--
| Prof. Dr. Torsten Grust grust at in.tum.de |
| http://www-db.in.tum.de/~grust/ |
| Database Systems - Technische Universität München (Germany) |
More information about the talk
mailing list