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?
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: New posts
On: 1259948499|%e %b %Y, %H:%M %Z|agohover
Number of posts: 2
RSS: New posts
Summary:
i.e. SELECT A.FIELD1, <PSQUERYNAME>, A.FIELD2
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?
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.