I have 2 tables :
Table_A
USERCODE|USERMOBILE|USERACCOUNT
001 |0123236556|ACC001
002 |0222222222|ACC002
Table_B
USERCODE|USERMOBILE
001 |0123236556
001 |0444444444
002 |0555555555
I want following output, which filter by Table_A.ACCOUNT
For example USERACCOUNT = ACC001
USERCODE|USERMOBILE
001 |0123236556
001 |0123236556
001 |0444444444
I try with following query but not work :
with tbl as
(select USERCODE,USERMOBILE from Table_A WHERE USERACCOUNT='ACC001' )
select * from tbl
union
select USERCODE,USERMOBILE from Table_B WHERE Table_B.USERCODE = tbl.USERCODE
Error : Invalid identifier : tbl.USERCODE
Are there any way to achive my expected result?