SerBel
5th September 2011, 09:34
Hi everyone!
According to progguide it is possible to use subqueries (derived tables) in FROM clause.
But in does not work. My code:
long rq_cnt
long rq_lines_cnt
select tdpur206.adep, tdpur206.aemn,
count(*) as rq_cnt,
sum(rq_lines.cnt) as rq_lines_cnt
from tdpur206
left join (select tdpur201.rqno, count(*) cnt
from tdpur201
group by tdpur201.rqno) rq_lines on tdpur206.rqno = rq_lines.rqno
group by tdpur206.adep, tdpur206.aemn
selectdo
message("rq_cnt=" & str$(rq_cnt) & " rq_lines_cnt=" & str$(rq_lines_cnt))
endselect
causes a compilation error "Error SQL: SQLState QP000: SQLStatement::doPrepare(): Unexpected exception (error 215)".
And even simle code:
long rq_lines_cnt
select rq_lines.cnt as rq_lines_cnt
from (select 1 as cnt from tdpur201) rq_lines
selectdo
message("rq_lines_cnt=" & str$(rq_lines_cnt))
endselect
causes the same error.
Infor support reported that "Internal revision showed that the compilation of the query on Porting Set 8.7a.02 was succesfull. Porting Set available at solution 22945298."
Recently I tested it on my server with Porting Set 8.7a.02 but this compilation error remained.
Can somebody else test these queries on Porting Set 8.7a.02? Or maybe it is working on other Porting Sets?...
According to progguide it is possible to use subqueries (derived tables) in FROM clause.
But in does not work. My code:
long rq_cnt
long rq_lines_cnt
select tdpur206.adep, tdpur206.aemn,
count(*) as rq_cnt,
sum(rq_lines.cnt) as rq_lines_cnt
from tdpur206
left join (select tdpur201.rqno, count(*) cnt
from tdpur201
group by tdpur201.rqno) rq_lines on tdpur206.rqno = rq_lines.rqno
group by tdpur206.adep, tdpur206.aemn
selectdo
message("rq_cnt=" & str$(rq_cnt) & " rq_lines_cnt=" & str$(rq_lines_cnt))
endselect
causes a compilation error "Error SQL: SQLState QP000: SQLStatement::doPrepare(): Unexpected exception (error 215)".
And even simle code:
long rq_lines_cnt
select rq_lines.cnt as rq_lines_cnt
from (select 1 as cnt from tdpur201) rq_lines
selectdo
message("rq_lines_cnt=" & str$(rq_lines_cnt))
endselect
causes the same error.
Infor support reported that "Internal revision showed that the compilation of the query on Porting Set 8.7a.02 was succesfull. Porting Set available at solution 22945298."
Recently I tested it on my server with Porting Set 8.7a.02 but this compilation error remained.
Can somebody else test these queries on Porting Set 8.7a.02? Or maybe it is working on other Porting Sets?...