Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: HANA SQL Sub Query - Unique Record

$
0
0

Appreciate your feedback, I was able to resolve it using the MAX function.

Below is my query.

 

Can you suggest a good document.


it_sales_data has the sales order data. My below query works perfect.

SELECT  b.mandt,b.vbeln,b.posnr,b.etenr,b.ettyp,b.edatu,
        b.bmeng as vbep_bmeng,b.vrkme as vbep_vrkme,b.mbdat,
        b.lifsp,b.lddat
        from :it_sales_data as a
        LEFT OUTER JOIN vbep as b on  a.mandt = b.mandt and
                                      a.vbeln = b.vbeln and
                                      a.posnr = b.posnr
       where b.bmeng = (select max(BMENG) from vbep as c where b.vbeln = c.vbeln and
                                                                                                          b.posnr = c.posnr )
       order by b.vbeln,b.posnr;


Viewing all articles
Browse latest Browse all 9165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>