From: xx r. <xx...@wi...> - 2010-09-12 11:22:02
|
Hi to you all, there have been a lot of times that you helped me understand xquery and solve numerous problems, so I'm comming back with another one. I want to find the average level per competence_category for a certain trainer, so I used a join and an aggregate function, but It seems that is not ok. Query for $comp in distinct-values(doc("/db/CMS_Project/Competences.xml")/Competences/Competence/Competence_Category), $z in doc("/db/CMS_Project/trainers.xml")/Trainers/TrainerInformation/Competences let $a := doc("/db/CMS_Project/trainers.xml")/Trainers/TrainerInformation/Competences[ Competence_Level ne "-" and Competence_Name=$z/Competence_Name and ../Identification/Name="ioannidis"] where $comp/../Competence_Name = $z/Competence_Name return <tr style="background-color:#EFECC5"><td>{$comp}</td> <td align="center">{round-half-to-even(avg($a/Competence_Level),2)}</td></tr> Result An exception occurred during query execution: cannot convert xdt:untypedAtomic('Professional') to a node set Can I have AGAIN a little help? Thank you very much Regards Christos |