Skip to main content
August 31, 2023
Question

Query Database Smart Service

  • August 31, 2023
  • 2 replies
  • 0 views

Hi! I´m trying to query a database with the following code (SQL) into the QueryDatabase Smart Service of the Process Model

SQL STATEMENT:

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Select sum(TotalLineas) as TotalFactura

from

(

Select PRECIO_UNIT*CANTIDAD as TotalLineas from CPF_LINEAS_FACTURA where ID_PEDIDO = ac!pedido
group by ID_UNICO

)

-------------------------------------------------------------------------------------------------------------------------------------------------------------

If I use the code selected in green it gives no problem. But If I try to include the second "select from"  I have the following error: 

What can be causing this? Any help would be useful

    2 replies

    stefanhelzle0001
    Brainy
    August 31, 2023

    Is there a reason to not use queryRecordType?

    August 31, 2023

    did you try with SELECT SUM( PRECIO_UNIT*CANTIDAD) as TotalLineas from CPF_LINEAS_FACTURA where ID_PEDIDO = ac!pedido
    group by ID_UNICO ?

    But I also suggest you use a!queryRecordType()