I have a requirement where i have to fetch some rows based on a condition and apart from that 2 more rows should be there in output one will be * and other will be a blank row. I am using the approach of Union to club that 2 extra rows.
Query :
SELECT '' as PROMO_GRP_CD , '' as PROMO_GRP_DESC, '' as PROMO_GRP_ALT_DESC
from PROMO_GROUP
UNION
SELECT '*' as PROMO_GRP_CD , 'All' as PROMO_GRP_DESC, 'Tous' as PROMO_GRP_ALT_DESC
from PROMO_GROUP
UNION
SELECT PROMO_GRP_CD,PROMO_GRP_DESC,PROMO_GRP_ALT_DESC from PROMO_GROUP
where ACC_TYPE = '*' and ACC_SUB_TYPE = '*' and SUBMARKET = '*'
In above Query first 2 selects from Table PROMO_GROUP gives me a blank row and a row with * value and below that i have normal select to retrieve data from Table PROMO_GROUP based on condition. Is there any other optimum way through which i can achieve this ?