Can someone help me to add the commented Join Condition in the below query. If I am executing this query is working fine but when I am trying to add one more join codition which is commented in the below query its not able to access the column high_V2 and giving column/table alisa not found issue.
with MYTABLE as (
select
T1.LOW_V2 as LOW_V2,
T2.LOW_V as LOW_V,
T2.HIGH_V as HIGH_V
from TAB1 T1
inner join
TAB2 T2
on
T1.LOW_V2=T2.LOW_V
-- and high_V2=T2.HIGH_V
)
select lpad(concat(splitted[0],translate(splitted[1],'0','9')),18,0) as high_V2,
LOW_V2,LOW_V,HIGH_V from
(
select split(regexp_replace(LOW_V2,'(\\d*?)(0+)$','$1|$2'),'\\|') splitted,
LOW_V2,
LOW_V,HIGH_V
from MYTABLE )s;