Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

HANA modeling results superseed

$
0
0

Hi,

 

I need an help in order to find a smarter solution in order to fulfill my requirement.

I'm modeling this in SQL Script into a Procedure in HANA, no possibility to use ABAP.

 

Currently I have to table

 

Table A

 

Afield1 -> key

Afield2 -> joins with Bfield1

Afield3 -> joins with Bfield2

Afield4 -> joins with Bfield3

 

Table B

 

Bfield1 - key

Bfield2 - key

Bfield3 - key

Bfield4 - value

 

Final expected output is:

Afield1

Afield2

Afield3

Afield4

Bfield4

 

 

Table B define a value based on the different matching of the three keys. My requirement is to match records from TableA with records of TableB following this rule:

 

try with the full Bkey if no results try with the partial key Bfield2, Bfield3, if still no results go with Bfield1.


I tried with union [distict], but if the join has different correspondences those are considered as different (Bfield4 has different values), I would love something like UNION DISTINCT WITH KEY.

I also tried to apply a score to the 3 queries in the union so I will have multiple records in the final output, but the problem is how I can delete the lower score records.

 

I hope my requirement is explained properly, I would appreciate any suggestion.

 

Does anyone have any idea?

 

Thank you

Ivan


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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