[xquery-talk] Fwd: Re: where clause

Michael Sokolov msokolov at safaribooksonline.com
Wed Mar 27 18:10:35 PST 2013


(forwarding Daniela's message)

Michael,

I think the ones with grouby and a where after the groupby are impossible to rewrite
in general (remember this from my optimizing SQL days). In this case the WHERE is the good old
HAVING clause of SQL.

Something along the lines of

for $x in blah
for $y in blah
group by $z:= $x/a, $t:= $y/b
where $z+$t >25
return $z

I am putting an informal syntax, obviously.

Another case is when the COUNT clause exists. You cannot move the where up and down in the tuple stream in
such a case.

for $x in Blah1
for $y in Blah2
count $i
where $x/a eq $y/b
return something using $i


HTH
Dana


On Mar 27, 2013, at 5:31 AM, Michael Sokolov wrote:

> I'm trying to come up with examples in which "where" clauses cannot be rewritten as XPath predicates.  So far, the ones I have all involve an "at" counter.  Are there others?
>
> --
> Michael Sokolov
> Senior Architect
> Safari Books Online
>
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk





More information about the talk mailing list