SELECT DISTINCT TMPL.RB_TEMPLATE_ID , TMPL.RB_TOKEN_ID FROM PS_RBC_TEMPLAT_TKN TMPL , PS_RB_RECP_TERMS TRM WHERE TMPL.RB_USE_TKNGRP = '0' AND TMPL.RB_TOKEN_ID = TRM.EOCF_LIB_TERM_ID UNION SELECT DISTINCT TMPL2.RB_TEMPLATE_ID , TRMG.RB_TOKEN_ID FROM PS_RBC_TEMPLAT_TKN TMPL2 , PS_RBC_TKNGRP_DTL TRMG , PS_RB_RECP_TERMS TRM2 WHERE TMPL2.RB_USE_TKNGRP = '1' AND TMPL2.RB_TOKEN_ID = TRMG.RB_TKNGRP_ID AND TRMG.RB_TOKEN_ID = TRM2.EOCF_LIB_TERM_ID UNION SELECT DISTINCT TMPL3.RB_TEMPLATE_ID , SUB3.RB_TOKEN_ID FROM PS_RBC_TEMPLAT_TKN TMPL3 , PS_RBC_SUBTMPL_TKN SUB3 , PS_RB_RECP_TERMS TRM3 WHERE TMPL3.RB_USE_TKNGRP = '2' AND TMPL3.RB_TOKEN_ID = SUB3.RB_SUBTMPLT_ID AND SUB3.RB_TOKEN_ID = TRM3.EOCF_LIB_TERM_ID UNION SELECT DISTINCT TMPL4.RB_TEMPLATE_ID , SUB4.RB_TOKEN_ID FROM PS_RBC_TEMPLAT_TKN TMPL4 , PS_RBC_SUBTMPL_TKN SUB4 , PS_RBC_TKNGRP_DTL TRMG4 , PS_RB_RECP_TERMS TRM4 WHERE TMPL4.RB_USE_TKNGRP = '2' AND TMPL4.RB_TOKEN_ID = SUB4.RB_SUBTMPLT_ID AND SUB4.RB_TOKEN_ID = TRMG4.RB_TKNGRP_ID AND TRMG4.RB_TOKEN_ID = TRM4.EOCF_LIB_TERM_ID
|