RE: Contents of WHERE a predicate?

Howard Katz wrote:
> Maybe I wasn't clear enough. I'm trying to understand how two LET queries
> differ, when one uses an inline XPath predicate,
>
>      LET $book := //book[  title = 'Data on the Web'  ]
>      RETURN
>             $book
>
> and the other uses a WHERE:
>
>     LET $book := //book
>     WHERE $book/title = 'Data on the Web'
>     RETURN
>            $book
>
> I'm trying to see if there's anything interesting or significant to be
> learned when that's the only distinction between the two. If you
> change one
> of the LET statements to a FOR, then that's a different problem
> and not the
> one I'm looking at here.

Okay, I think you're implying that some rule dictates that the above two
queries mean the same thing. That's definitely not the case. In the first
query, the comparison is evaluated once for every book element in the
document. In the second query, the comparison is evaluated only once,
period. Think of "WHERE" as "IF" without an "ELSE" and maybe that will make
more sense.

Evan

Received on Tuesday, 24 April 2001 19:11:05 UTC