0

sub-select all

I am just wondering if it is possible to grab the entire result from a sub-select to be used in a wrapping select. Ideally something like the following would be great:

CODE
select * from mytable where value="myvalue" and data=(select * from othertable …)


The sub-select could be basically any YQL query result at all, which would be fed into an execute block for me to play around with. If possible, I'd rather not have to have the sub-select as a string; preferably a query proper.

In closing, I've also tried content in (select content from …) to no avail.

by
2 Replies
  • QUOTE (hfsalathe @ Apr 15 2010, 11:00 AM) <{POST_SNAPBACK}>
    I am just wondering if it is possible to grab the entire result from a sub-select to be used in a wrapping select. Ideally something like the following would be great:

    CODE
    select * from mytable where value="myvalue" and data=(select * from othertable …)


    The sub-select could be basically any YQL query result at all, which would be fed into an execute block for me to play around with. If possible, I'd rather not have to have the sub-select as a string; preferably a query proper.

    In closing, I've also tried content in (select content from …) to no avail.


    So sub-selects give you "lists" of values so you'll generally be using "in" instead of "=" in the outer-select. There will be a way of doing this soon using user-defined functions (like | sort() ) but at the moment you need to return the same number of fields you want to compare in the outer-select with the inner select.

    Of course, you could also create your own table and then it becomes pretty easy (you could "toString()" the XML or extract the particular pieces you wanted with xpath and so on) before doing the join.

    Jonathan
    0
  • QUOTE (Jonathan @ Apr 16 2010, 08:01 AM) <{POST_SNAPBACK}>
    There will be a way of doing this soon using user-defined functions (like | sort() )

    This looks to be a very useful addition and could well come in handy as a different approach to the case I'm trying to solve which lead to this thread. I'll be keeping an eye out for user-defined functions to be unveiled.

    QUOTE (Jonathan @ Apr 16 2010, 08:01 AM) <{POST_SNAPBACK}>
    Of course, you could also create your own table and then it becomes pretty easy (you could "toString()" the XML or extract the particular pieces you wanted with xpath and so on) before doing the join.

    I did go down this road, but ended up having the sub-select being a string in the query which was not really what I wanted.

    Also, would it be possible to bounce a few ideas off of you (Jonathan) in private? My email is the username belonging to this post @php.net

    Cheers
    0

Recent Posts

in YQL