Quote Originally Posted by reydp
(msg_message_type!='0' and msg_message_type!='1')
This is a horrible predicate.

There is just one thing uglier than a "NOT EQUAL" condition which is, two "NOT EQUAL" conditions joined by and AND.

Fix the inline view.