Hello I’m working with tamino v4.2
Having the following document structure:
I’d like to perform a group by operation
Sql syntax
select username, count(username)
from log
where description = “App search” and date like “%06/2008%”
group by username
How the sql query above would be in xquery?
I’ve tried the following one but count operation returns always 0 and I don’t know why …
declare namespace tf=“http://namespaces.softwareag.com/tamino/TaminoFunction”
let $a := (
for $b in log
where (($b/description = “App search”) and (tf:containsText($b/date,“???06/2008*”)))
return $b
)
for $d in distinct-values($a/username/text())
return
{$d}
{
let $z := (for $c in input()/log
where (
($c/description = “App search”) and (tf:containsText($c/date,“???06/2008*”))
and ($c/username = “$d/text()”)
)
return $c
)return
<cont>
{count($z)}
</cont>
}
Any help would be much appreciate.
Thanks in advance.
#API-Management#Tamino#webMethods