Max value row and lookup value [message #683653] |
Wed, 10 February 2021 12:07 |
|
suji6281
Messages: 135 Registered: September 2014
|
Senior Member |
|
|
Hi Team,
Can you please help me with the Query with the below criteria.
1) select highest version rows from hdr_tbl for each id
2) select corresponding rows from line_tbl
3) one of select field should be derived from other mapping table (lookup_tbl)
hdr_tbl:
id version name address1
1 1 John Texas
1 2 John Mexico
1 3 John NewYork
2 3 Mike Florida
2 4 Mike Alaska
line_tbl:
id version qty amount code
1 1 25 25000 A1
1 2 12 12000 A2
1 3 10 10000 A3
2 3 22 22000 A2
2 4 44 44000 A1
lookup_tbl:
code descr
A1 buyer
A2 seller
A3 customer
output:
id version name qty amount descr
1 3 John 10 10000 customer
2 4 Mike 44 44000 buyer
Thank you.
Regards
Suji
|
|
|
|
|
|
|