Subject:counting in query Author:Giuseppe Frattura Date:15 Sep 2010 05:03 AM Originally Posted: 15 Sep 2010 05:02 AM
hi everybody,
i've got another problem with my project.
i've got a Database on XML that contains data about museum ecc...
how can i count how many artwork did any artist do?
i've try to do like that:
(: $x is the root :)
for $c in $x//artwork
let $artist:= $c/Autor
let $count:=0
let $finalCount := for $k in $x//opera
let $count:= $count + (if ($k/Autor/text()=$artist/text())
then ($count+1)
else ($count))
return $count
return <a>{$finalCount}</a>