bug 1010: fixed sql-statement for org query and the filter for status