开发者

XML & YQL (similar to SQL) - how to get a subnode's attribute?

I'm trying to select a certain set of data with YQL, but I'm confused on how to get to sublevels with my YQL. For example, if I run this query:

select * from music.track.search where keyword="Asia"

I get this:

<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="22" yahoo:created="2011-07-07T16:47:41Z" yahoo:lang="en-US">
    <results>
        <Track discNumber="1" duration="0" explicit="0" flags="0"
            id="61642071" label="Mark Saliba" popularity="3" rating="-1"
            releaseYear="2008" rights="2208" title="Asia"
            trackNumber="3" url="http://new.music.yahoo.com/mark-j-saliba/tracks/asia--61642071">
            <Artist catzillaID="0" flags="2" hotzillaID="0"
                id="205843271" name="Mark J Saliba" rating="-1"
                trackCount="11"
                url="http://new.music.yahoo.com/mark-j-saliba/" website=""/>
            <Album>

and if I run this query:

select ID from music.track.search where keyword="Asia"

I get this:

<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"
    yahoo:count="22" yahoo:created="2011-07-07T16:50:13Z" yahoo:lang="en-US"> 
    <results>
        <Track 开发者_运维知识库id="61642071"/>...

But what I want to do is just get the artist IDs, not the track IDs (specifically, just the first result would be fine). What is the YQL statement for that?


For all artist ids:

select Artist.id from music.track.search where keyword="Asia"

For just the first artist id:

select Artist.id from music.track.search where keyword="Asia" limit 1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜