cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Can't use alias in a Service Layer SQLQueries ORDER BY clause

denlen
Newcomer
0 Likes
557

Hi

I have tried to create an entry in Service Layer SQLQueries on SAP Business One 10  SP2402 with the following:

 

select top 12 RDR1.ItemCode, sum(RDR1.Quantity) as Q
from RDR1 where RDR1.DocEntry in
(select top 50 ORDR.DocEntry from ORDR where ORDR.CardCode = :bpid order by ORDR.DocDate desc)
group by RDR1.ItemCode
order by Q desc

 

but it fails with

 

400 Bad Request
error code 703
message: Column 'Q' from table 'RDR1' not exist.

 

I did try other simpler queries also using an alias in the order by clause, but they all fail the same way.

Thanks, Denes

Accepted Solutions (0)

Answers (0)