0

YQL SELECT does not work as expected

I'm trying to create an RSS feed or similar of Jay Lenos garage video site,
sadly I think that the select statement is lacking in that it does not treat items as "rows"

select div.div.p, div.div.a.href from html where url ="http://www.jaylenosgarage.com/" and xpath = "//div[@class='scrollable']/div"


Gives me the result set x3, rather than around 250 results.
Is there some functionality within YQL that I have missed for this kind of query?

Thanks

by
1 Reply
  • QUOTE (benschwarz @ May 12 2009, 10:18 PM) <{POST_SNAPBACK}>
    I'm trying to create an RSS feed or similar of Jay Lenos garage video site,
    sadly I think that the select statement is lacking in that it does not treat items as "rows"

    select div.div.p, div.div.a.href from html where url ="http://www.jaylenosgarage.com/" and xpath = "//div[@class='scrollable']/div"


    Gives me the result set x3, rather than around 250 results.
    Is there some functionality within YQL that I have missed for this kind of query?

    Thanks


    Yes. Infact the product of elements happens in this case because the projected fields are trying to key into an array. Each div contains an array of divs and since you are trying to project a single "div" YQL creates a product of the number of divs per element.

    Please checkout the section on "HANDLING ONE-TO-MANY RELATIONSHIPS" in http://developer.yahoo.com/yql/guide/selec...statements.html

    That said, if you do not want the product of the elements, then I'd recommend using "*" as the projection


    select * from html where url ="http://www.jaylenosgarage.com/" and xpath = "//div[@class='scrollable']/div"


    -- Nagesh
    0

Recent Posts

in YQL