There have been a number of good ideas on how to rewrite the query. I plan
to test them out later to help me learn. My query writing ability is
probably a 0 out of 10.
The only problem with rewriting the query is that this is suppose to
represent a row based security implementation. For example,
User fred logs into the database and runs the query : select count(*) from
fred.table_A
User fred's query will automatically be appended with the where clause
without him knowing about it.
select count(*) from fred.table_a A where A.col_1 in (select col_3 from fred.table_b B where B.col_4 = '662') or A.col_2 in (select col_3 from fred.table_b B where B.col_4 = '662')
Thanks