YQL(Yahoo!查询语言) - 帮助添加参数

时间:2011-08-25 09:04:38

标签: yql

我正在做一个非常简单的YQL语句:

select * from xml where url="http://www.wowhead.com/item=50278&xml"

其余查询看起来像这样(超长的疯狂网址转义码):

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D%22http%3A%2F%2Fwww.wowhead.com%2Fitem%3D50278%26amp%3Bamp%3Bxml%22

所以我正在尝试使用查询别名来缩短它。我知道我可以使用类似url = @参数的东西,但我怎么做呢,所以项目编号是变量,其余查询看起来像:

http://query.yahooapis.com/v1/public/yql/RVCA18/wowheadXML?item=50278

我很感激帮助:)

1 个答案:

答案 0 :(得分:4)

您可以使用 URI模板info构建XML文件的URL,YQL使用03草案)。执行此操作的YQL查询如下所示。

select * from xml where url in (
    select url from uritemplate 
    where template="http://www.wowhead.com/item={item}&xml" and item=@item
);

Try this in the YQL console)功能

下一个阶段(看起来您已经知道该怎么做)是将上述查询别名为wowheadXML,并使用查询字符串中的item值调用它{{3} })。

相关问题