0

uritemplate as subquery

I have been trying to use the uritemplate table as a sub-query to construct urls for another table. However, I cannot determine the correct "column" name to use as only * seems to work.

What I would like to do is something similar to the following, except the highlighted portion will cause problems as I don't know what to use there (* won't work for sub-queries).

Simplified, generic example
CODE
SELECT * FROM xml WHERE url IN (
SELECT url <-- what goes here?
FROM uritemplate
WHERE template = 'http://example.org/'
)

by
2 Replies
  • Use "content" in your subquery.

    Since you want the textContent of the element url to be projected out, simply specifying "content" should give you the behavior that you need.

    CODE
    SELECT * FROM xml WHERE url IN (
    SELECT content
    FROM uritemplate
    WHERE template = 'http://example.org/'
    )


    -- Nagesh

    QUOTE (Salathe @ May 31 2009, 04:21 PM) <{POST_SNAPBACK}>
    I have been trying to use the uritemplate table as a sub-query to construct urls for another table. However, I cannot determine the correct "column" name to use as only * seems to work.

    What I would like to do is something similar to the following, except the highlighted portion will cause problems as I don't know what to use there (* won't work for sub-queries).

    Simplified, generic example
    CODE
    SELECT * FROM xml WHERE url IN (
    SELECT url <-- what goes here?
    FROM uritemplate
    WHERE template = 'http://example.org/'
    )
    0
  • Thanks, using content is what I needed.
    0

Recent Posts

in YQL