Dear Team
I am using the group by for getting top n number of record like below mentioned query
(for $areaData in collection('mycollection') let $areaName := $areaData/Contry group by $areaName return $areaData )[position() lt 100]
In this case i am getting first top 100 records and then it is grouping on those records.Can you please suggest me how can we get the top 100 records based on the Country name
Please find the attachment for the sample data.Please do the need full on this/
Thanks&Regards
Chandra Sekhar
The information contained in this e-mail and any accompanying documents may contain information that is confidential or otherwise protected from disclosure. If you are not the intended recipient of this message, or if this message has been addressed to you in error, please immediately alert the sender by reply e-mail and then delete this message, including any attachments. Any dissemination, distribution or other use of the contents of this message by anyone other than the intended recipient is strictly prohibited.
(for $areaData in collection('mycollection') let $areaName := $areaData/Contry group by $areaName return $areaData )[position() lt 100]
This will always give you an empty sequence, because there are no "Contry" elements, at least not in your sample data.
Can you please suggest me how can we get the top 100 records based on the Country name
What do you mean with "Top 100"? If you are interested in the first 100 entries of your database, and if you want to have all records grouped by their country, try this:
(for $r in collection('mycollection')/Data/R group by $country := $r/Country return $r)[position() lt 100]
Please do the need full on this/
basex-talk@mailman.uni-konstanz.de