How to rewrite this???
Hello All,
I have a query like this
SELECT bo_no AS ins_no, bo_year AS ins_year, '11' AS trade_type,
flag_atypical
FROM one_re_client
WHERE bo_class = 'INS' AND flag_atypical = 'Y'
UNION ALL
SELECT
bo_no AS ins_no, bo_year AS ins_year, '21' AS trade_type,
flag_atypical
FROM one_re_client
WHERE bo_class = 'INS' AND flag_atypical = 'Y'
1. Is there a way to combine these two statements into one?? I want to access the table only once. Is that possible??
And another thing in the table there are NO rows for the condition "flag_atypical = 'Y'" but unfortunately to come out with 0 rows it takes a lot of time. flag_atypical column is NOT included in any index. How do I tune this.
I have a query like this
SELECT bo_no AS ins_no, bo_year AS ins_year, '11' AS trade_type,
flag_atypical
FROM one_re_client
WHERE bo_class = 'INS' AND flag_atypical = 'Y'
UNION ALL
SELECT
bo_no AS ins_no, bo_year AS ins_year, '21' AS trade_type,
flag_atypical
FROM one_re_client
WHERE bo_class = 'INS' AND flag_atypical = 'Y'
1. Is there a way to combine these two statements into one?? I want to access the table only once. Is that possible??
And another thing in the table there are NO rows for the condition "flag_atypical = 'Y'" but unfortunately to come out with 0 rows it takes a lot of time. flag_atypical column is NOT included in any index. How do I tune this.
0