我在伦敦有一个车站 - 沃伦街站,尤斯顿,我必须返回与沃伦街车站有相同自行车可用性的车站,并且至少有许多空文件。我写了一个小的查询来返回沃伦街站及其可用性,但是我如何返回所有其他站点的列表,这些站点具有与我的沃伦街站一样多的空码头?
<results>{ for $b in doc("http://tinyurl.com/TFLStationsXMLFile")
/stations/station
where $b/name = "Warren Street Station, Euston"
order by $b
return
<result>
{ $b/name }
{ $b/nb_bikes }
{ $b/nb_empty_docks }
</result>}
</results>
答案 0 :(得分:0)
let $warren-station := doc("http://tinyurl.com/TFLStationsXMLFile")/stations/station[name eq "Warren Street Station, Euston"]
return
<results>{ for $b in doc("http://tinyurl.com/TFLStationsXMLFile")/stations/station
where $b/nb_bikes eq $warren-station/nb_bikes and $b/nb_empty_docks ge $warren-station/nb_empty_docks
order by $b
return
<result>
{ $b/name }
{ $b/nb_bikes }
{ $b/nb_empty_docks }
</result>}
</results>
这样的事情。 HTH!