Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8695

Re: MAX funtionality in HANA

$
0
0

Hmm... the SQL reference documentation has the full syntax covered...

Anyway:

In the statement you posted the INNER JOIN clause is positioned wrong (_after_ the WHERE clause).

 

Try this instead:

 

SELECT   "BILL_VBELN","BILL_FKDAT","BILL_KVGR1_1","BILL_FIL_PROFORMA_INV"  ,"BILL_KUNRG","BILL_KTGRD_1","BILL_VKORG_VBRK","BILL_INCO1"  ,"BILL_INCO2","BILL_PRCTR","BILL_POSNR","ROUTE","BILL_AUPOS"  ,"GET_DAYS","BILL_DATE_FY","BILL_DATE_FP","TO_DATE_EUDAT"  ,"TO_DATE_WADAT","DEL_DATE_CALC","TRAN_TIME"  ,"CA_BILL_REP_NETWR_COMP_CURR","CA_BILL_REP_WAVWR_COMP_CURR","NEW_DEL_DATE"
FROM  "_SYS_BIC"."pk-sample.productmanagement/CV_REVENUE_RECOG_CUTOFF_PVP" t1
INNER JOIN  (SELECT "BILL_VBELN","BILL_AUPOS", MAX("NEW_DEL_DATE") AS "NEW_DEL_DATE"  FROM "_SYS_BIC"."pk-sample.productmanagement/CV_REVENUE_RECOG_CUTOFF_PVP"  WHERE  BILL_VBELN = '9043128697'   AND  BILL_AUPOS = '001710'  GROUP BY "BILL_VBELN" , "BILL_AUPOS")  t2  ON (t1.bill_vbeln,  t1.bill_aupos) = (t2.bill_vbeln, t2.bill_aupos)
WHERE  t1."BILL_VBELN" = '9043128697'
AND t1."BILL_AUPOS" = '001710'

 

On a side note: make your life as a SQL coder easier and adopt a rule for if you want to write keywords upper or lower case (consistency really helps here) and when you use double quotes.

In the statement above, some columns where references with double quotes while the names where written in lower case.

That would have lead to errors as well.

 

A good formatting of your SQL can get you far to avoid getting "lost" in the syntax and logic of a statement.


Viewing all articles
Browse latest Browse all 8695

Trending Articles