I have below queries like:-
select * from notification_email where is_send_email_flag = 'N';
select * from notification_email;
first query returns data which have is_send_email_flag = 'N'
and second query returns all records irrespective of is_send_email_flag in('N','Y')
So,for that i have created two stored procedures.
But i want to merge these queries into one and pass @is_send_email_flag variable to get all records or only is_send_email_flag = 'N'.
So how do i achieve that one with one query.I have written somewhere with Coalesce function which returns all records if no value is passed in a query.
But i forgot. Can anyone help me to solve my problem.Because unnecessary i am writing 2 queries.