Skip to Content
0
Jun 01, 2020 at 08:28 AM

Error In Upsert Query

382 Views Last edit Jun 01, 2020 at 09:20 AM 4 rev

Writing an upsert query that takes data input from a Select query. I need to have an alias of Select query so that i can use it in last WHERE clause. Select query is working when i run it separately but not able to have an alias of it because of that where condition can't be met and query is failing to execute. Running this query in Hana Service.

Below are the snippet of tables.

COM_SAP_APIMGMT_ANALYTICS_READSERVICE_MASTER_TABLE

COM_SAP_APIMGMT_ANALYTICS_READSERVICE_AGGREGATED_TABLE

upsert "98CF35ADCA7E47999D27B1D4EA8228F8"."COM_SAP_APIMGMT_ANALYTICS_READSERVICE_AGGREGATED_TABLE" AS AGG_TABLE

( "ID",

"APIPROXY",

"REQUESTMETHOD",

)

VALUES (

SELECT

SYSUUID,

"API_PROXY",

"REQUEST_METHOD",

FROM "COM_SAP_APIMGMT_ANALYTICS_READSERVICE_MASTER_TABLE" AS FACT_TABLE

WHERE

"CREATED_TIME" >= '2020-05-16 09:00:00.000000000' AND "CREATED_TIME" <= '2020-05-16 09:30:00.000000000' 

GROUP BY

"API_PROXY",

"REQUEST_URL",

"PROXY_BASEPATH",

"REQUEST_METHOD",

)

WHERE

AGG_TABLE."APIPROXY" = FACT_TABLE."API_PROXY" AND

AGG_TABLE."REQUESTMETHOD" = FACT_TABLE."REQUEST_METHOD"


Attachments

knz8w.png (49.2 kB)
njutt.png (22.4 kB)