Can you select another query in a query?
Forum » Forum / Help » Can you select another query in a query?
Started by: Mike B. (guest)
On: 1259948499|%e %b %Y, %H:%M %Z|agohover
Number of posts: 2
rss icon RSS: New posts
Summary:
i.e. SELECT A.FIELD1, <PSQUERYNAME>, A.FIELD2
Can you select another query in a query?
Mike B. (guest) 1259948499|%e %b %Y, %H:%M %Z|agohover

I'm trying to select the results of a select, e.g.
SELECT A.FIELD1, (SELECT B.FIELDB FROM TABLE2 B) FROM TABLE1 A
and it was suggested that I might be able to do this by making the embedded SELECT a separate query and then referencing it. Is this possible? If not, is there another way to do this?

Reply  |  Options
Unfold Can you select another query in a query? by Mike B. (guest), 1259948499|%e %b %Y, %H:%M %Z|agohover
Re: Can you select another query in a query?
PrajPraj 1259971532|%e %b %Y, %H:%M %Z|agohover

Hi, unfortunately I don't think this is possible in PeopleSoft Query. There's no way to reference a query in a select statement (you can of course use sub-queries in your criteria), and you can't have an expression with a FROM clause in it as it gives you an error (139,106). So that means you can't write (SELECT B.FIELDB FROM TABLE2 B) as an expression and use it as a field.

I think this is a pretty serious limitation. One way around this is to create a view that performs this sub-select and then to use that view in your query.

Last edited on 1259974689|%e %b %Y, %H:%M %Z|agohover By Praj + Show more
Reply  |  Options
Unfold Re: Can you select another query in a query? by PrajPraj, 1259971532|%e %b %Y, %H:%M %Z|agohover
New Post
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License