How To Apply Filter In Sql Query