I have the following SQL query, in which I make use of UNIONs:
SELECT notification FROM NotificationDb notification WHERE notification.proc_name = 'a' AND notification.status = 1 AND notification.module = 1
UNION
SELECT notification FROM NotificationDb notification WHERE notification.proc_name = 'b' AND notification.param1 >0 AND notification.status = 1 AND notification.module = 1
UNION
SELECT notification FROM NotificationDb notification WHERE notification.proc_name = 'b' AND notification.param1 <= 0 AND notification.status = 1 AND notification.module = 1
I have it set up this way, because I need them ordered by proc_name field and also param1 value for cases where proc_name is 'b'
QUESTION: Is there a better, a more efficient way of putting together a query that would return the same result?
Any help would be appreciated!
UNION ALL