用 yql 获取随机行?
我想使用 javascript 从 flickr 中使用 yql 获取数据, 例如
select id from flickr.photos.search(10) where text = 'music' and license=4
,但是,我想获取 10 个随机行,而不是最新的,因为最新的往往是来自同一个人的 10 张照片。
yql 本身有可能(我怀疑不可能), 或任何可以带来相同效果的解决方法? (它不必是完全随机的,我主要想避免的是从同一张海报中获取 10 张照片)
I want to use javascript to fetch data with yql from flickr,
e.g.
select id from flickr.photos.search(10) where text = 'music' and license=4
however, I would like to fetch 10 random rows, rather then the latest, since the latest tend to be 10 photos all from the same person.
ist that possible in yql itself (I suspect not),
or any workarounds that could bring the same effect?
(it does not have to be complete random, the main thing I want to avoid is to get 10 photos from the same poster)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要仅获取唯一
所有者
的结果,您可以使用unique()
函数(文档)。我的建议是查询更大的结果集(更有可能有 10 个不同的人),然后调用
unique()
,然后调用truncate()
将结果限制为 10 个,如下。To get only results from unique
owner
s, you can use theunique()
function (docs).My suggestion would be to query for a larger result set (more likely to have 10 unique people) then call
unique()
followed bytruncate()
to limit to 10 results, as below.